//Thanks to Destroy & Dimed for the idea & Bhpsngum for code help
//Based on Team Rumble from Fortnite
var modifier = {
  map_size: 60,
  crystal_value: 0,
  max_players: 20,
  kills_to_win: 100,
  yeet_gems: true,
  healer_button: false,
  round_timer: 30, // in minutes
  game_delay: 60, // in seconds
  round_ship_tier: "random", // choose from 3-7 or "random"
  gems_upon_spawning: 0, // removed
  laggy_objs: false,
  friendly_fire: "random", // toggle friendly fire (ability to kill teammates), or "random" (10% true, 90% false)
  max_trolls_attempt: 3
};

var modUtils = {
  setTimeout: function(f,time) {
    this.jobs.push({f: f,time: game.step+time}) ;
  },
  jobs: [],
  tick: function() {
    var t = game.step;
    for (var i=this.jobs.length-1;i>=0;i--) {
      var job = this.jobs[i] ;
      if (t>=job.time) {
        try {
          job.f() ;
        }
        catch (err) {
        }
        this.jobs.splice(i,1) ;
      }
    }
  }
};

var sendUI = function(ship, UI) {
  if (ship != null && typeof ship.setUIComponent == "function") {
    if (UI.visible || UI.visible == null) ship.setUIComponent(UI);
    else ship.setUIComponent({id: UI.id, position: [0,0,0,0], visible: false});
  }
};

var a = {};
a.Barracuda = '{"name":"Barracuda","level":6,"model":7,"size":2.4,"specs":{"shield":{"capacity":[300,400],"reload":[8,12]},"generator":{"capacity":[100,150],"reload":[8,14]},"ship":{"mass":550,"speed":[70,90],"rotation":[30,45],"acceleration":[130,150],"dash":{"rate":2,"burst_speed":[160,180],"speed":[100,130],"acceleration":[70,70],"initial_energy":[50,75],"energy":[20,30]}}},"bodies":{"body":{"section_segments":12,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-90,-100,-60,-10,0,20,50,80,100,90],"z":[0,0,0,0,0,0,0,0,0,0,0]},"width":[0,5,20,25,35,40,40,35,30,0],"height":[0,5,40,45,40,60,70,60,30,0],"texture":[10,2,10,2,3,13,13,63,12],"propeller":true},"front":{"section_segments":8,"offset":{"x":0,"y":-20,"z":0},"position":{"x":[0,0,0,0,0],"y":[-90,-85,-70,-60,-20],"z":[0,0,0,0,0]},"width":[0,40,45,10,12],"height":[0,15,18,8,12],"texture":[8,63,4,4,4],"propeller":true},"propeller":{"section_segments":10,"offset":{"x":40,"y":40,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-20,-15,0,10,20,25,30,40,70,60],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,10,15,15,15,10,10,20,15,0],"height":[0,10,15,15,15,10,10,18,8,0],"texture":[4,4,10,3,3,63,4,63,12],"propeller":true},"sides":{"section_segments":6,"angle":90,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-10,10,50,60,75,80],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,30,35,10,12,12,10,35,30,0],"height":[0,10,12,8,12,12,8,12,10,0],"texture":[4,63,4,4,4,4,4,63,4]},"cockpit":{"section_segments":12,"offset":{"x":0,"y":-20,"z":30},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-50,-20,0,10,30,50],"z":[0,0,0,0,0,0]},"width":[0,12,18,20,15,0],"height":[0,20,22,24,20,0],"texture":[9]}},"wings":{"top":{"doubleside":true,"offset":{"x":0,"y":20,"z":15},"length":[70],"width":[70,30],"angle":[90],"position":[0,30],"texture":[63],"bump":{"position":10,"size":30}},"top2":{"doubleside":true,"offset":{"x":0,"y":51,"z":5},"length":[70],"width":[50,20],"angle":[90],"position":[0,60],"texture":[63],"bump":{"position":10,"size":30}}},"typespec":{"name":"Barracuda","level":6,"model":7,"code":607,"specs":{"shield":{"capacity":[300,400],"reload":[8,12]},"generator":{"capacity":[100,150],"reload":[8,14]},"ship":{"mass":550,"speed":[70,90],"rotation":[30,45],"acceleration":[130,150],"dash":{"rate":2,"burst_speed":[160,180],"speed":[100,130],"acceleration":[70,70],"initial_energy":[50,75],"energy":[20,30]}}},"shape":[5.28,5.25,5.332,5.393,4.944,1.997,1.745,1.556,1.435,3.587,3.81,3.779,3.838,3.84,3.779,3.81,3.587,3.205,3.571,3.9,5.132,5.888,5.835,5.551,4.886,5.808,4.886,5.551,5.835,5.888,5.132,3.9,3.571,3.205,3.587,3.81,3.779,3.838,3.84,3.779,3.81,3.587,1.435,1.556,1.745,1.997,4.944,5.393,5.332,5.25],"lasers":[],"radius":5.888}}';
a.H_Mercury = '{"name":"H-Mercury","level":6,"model":9,"size":2,"specs":{"shield":{"capacity":[250,400],"reload":[6,9]},"generator":{"capacity":[100,175],"reload":[45,60]},"ship":{"mass":430,"speed":[75,90],"rotation":[50,65],"acceleration":[60,100]}},"bodies":{"main":{"section_segments":8,"offset":{"x":0,"y":0,"z":20},"position":{"x":[0,0,0,0,0,0,0,0,0],"y":[-65,-70,-60,-40,0,50,110,100],"z":[0,0,0,0,0,0,0,0]},"width":[1,5,10,20,30,25,10,0],"height":[1,5,10,15,25,20,10,0],"texture":[6,4,4,63,11,63,12],"propeller":true,"laser":{"damage":[7,12],"rate":8,"type":1,"speed":[100,190],"number":1,"error":0}},"cockpit":{"section_segments":8,"offset":{"x":0,"y":-20,"z":35},"position":{"x":[0,0,0,0,0,0,0],"y":[-20,-10,0,15,25],"z":[0,0,0,0,0]},"width":[0,10,12,10,5],"height":[0,10,13,12,5],"texture":[9,9,4,4],"propeller":false},"arms":{"section_segments":8,"offset":{"x":60,"y":0,"z":-10},"position":{"x":[0,0,0,5,10,0,0,-10],"y":[-85,-70,-80,-30,0,30,100,90],"z":[0,0,0,0,0,0,0,0]},"width":[1,5,6,15,15,15,10,0],"height":[1,5,6,20,30,25,10,0],"texture":[6,4,4,4,4,4,12],"angle":1,"propeller":true,"laser":{"damage":[2,4],"rate":4,"type":1,"speed":[150,200],"number":1,"error":0}},"canon":{"section_segments":12,"offset":{"x":100,"y":27,"z":5},"position":{"x":[0,0,0,0,0,0,0],"y":[-50,-45,-20,0,20,30,40],"z":[0,0,0,0,0,0,0]},"width":[0,5,7,7,3,5,0],"height":[0,5,15,15,3,5,0],"angle":3,"laser":{"damage":[4,9],"rate":1.5,"type":1,"speed":[150,220],"number":1,"error":0},"propeller":false,"texture":[6,4,10,4,4,4]}},"wings":{"main":{"offset":{"x":0,"y":-15,"z":20},"length":[60,40],"width":[60,30,20],"angle":[-20,10],"position":[30,50,30],"texture":[11,11],"bump":{"position":30,"size":10}},"font":{"length":[60],"width":[20,15],"angle":[-10,20],"position":[-20,-40],"texture":[63],"bump":{"position":30,"size":10},"offset":{"x":0,"y":0,"z":0}},"font2":{"offset":{"x":0,"y":40,"z":8},"length":[60],"width":[20,15],"angle":[-10,20],"position":[20,40],"texture":[63],"bump":{"position":30,"size":10}}},"typespec":{"name":"H-Mercury","level":6,"model":9,"code":609,"specs":{"shield":{"capacity":[250,400],"reload":[6,9]},"generator":{"capacity":[100,175],"reload":[45,60]},"ship":{"mass":430,"speed":[75,90],"rotation":[50,65],"acceleration":[60,100]}},"shape":[2.806,2.807,2.354,2.037,1.822,4.151,4.081,3.789,3.595,3.471,3.406,4.17,4.202,4.284,4.413,4.508,4.834,4.883,4.011,4.534,4.917,4.734,3.583,3.454,4.418,4.409,4.418,3.454,3.583,4.734,4.917,4.534,4.011,4.883,4.834,4.508,4.413,4.284,4.202,4.17,3.406,3.471,3.595,3.789,4.081,4.151,1.822,2.037,2.354,2.807],"lasers":[{"x":0,"y":-2.8,"z":0.8,"angle":0,"damage":[7,12],"rate":8,"type":1,"speed":[100,190],"number":1,"spread":0,"error":0,"recoil":0},{"x":2.341,"y":-3.399,"z":-0.4,"angle":1,"damage":[2,4],"rate":4,"type":1,"speed":[150,200],"number":1,"spread":0,"error":0,"recoil":0},{"x":-2.341,"y":-3.399,"z":-0.4,"angle":-1,"damage":[2,4],"rate":4,"type":1,"speed":[150,200],"number":1,"spread":0,"error":0,"recoil":0},{"x":3.895,"y":-0.917,"z":0.2,"angle":3,"damage":[4,9],"rate":1.5,"type":1,"speed":[150,220],"number":1,"spread":0,"error":0,"recoil":0},{"x":-3.895,"y":-0.917,"z":0.2,"angle":-3,"damage":[4,9],"rate":1.5,"type":1,"speed":[150,220],"number":1,"spread":0,"error":0,"recoil":0}],"radius":4.917}}';
a.Toscain = '{"name":"Toscain","level":5,"model":8,"size":1.7,"specs":{"shield":{"capacity":[275,350],"reload":[5,8]},"generator":{"capacity":[75,100],"reload":[35,50]},"ship":{"mass":300,"speed":[80,90],"rotation":[50,80],"acceleration":[80,110]}},"bodies":{"front":{"section_segments":8,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0],"y":[-100,-95,-25,0,25],"z":[0,0,0,0,0]},"width":[0,20,40,40,20],"height":[0,10,35,20,5],"texture":[63,11,2,63],"laser":{"damage":[14,30],"rate":1,"type":2,"speed":[150,200],"number":1,"recoil":50,"error":0}},"cockpit":{"section_segments":8,"offset":{"x":0,"y":0,"z":10},"position":{"x":[0,0,0,0,0],"y":[-70,-70,-25,0,100],"z":[0,0,0,0,9]},"width":[0,10,15,15,10],"height":[0,15,35,20,0],"texture":[9,9,9,4]},"lasers":{"section_segments":8,"angle":15,"offset":{"x":1,"y":-5,"z":-3},"position":{"x":[0,0,0],"y":[-90,-70,-100],"z":[0,0,0]},"width":[5,5,0],"height":[5,5,0],"texture":[6],"laser":{"damage":[3.75,6],"rate":2,"type":1,"speed":[100,130],"number":2,"angle":45,"error":0}},"motor":{"section_segments":8,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0],"y":[10,20,30,100,95],"z":[0,0,0,0,0]},"width":[0,40,50,50,0],"height":[0,10,15,20,0],"texture":[63,63,10,4]},"propulsors":{"section_segments":8,"offset":{"x":25,"y":0,"z":0},"position":{"x":[0,0,0],"y":[30,105,100],"z":[0,0,0]},"width":[15,15,0],"height":[10,10,0],"propeller":true,"texture":[12]}},"wings":{"main":{"doubleside":true,"offset":{"x":30,"y":80,"z":0},"length":[70,20],"width":[80,20],"angle":[0,0],"position":[-20,0],"texture":[11],"bump":{"position":20,"size":10}},"winglets":{"doubleside":true,"offset":{"x":98,"y":81,"z":-20},"length":[20,50,20],"width":[20,35,20],"angle":[90,90,90],"position":[0,0,0,0],"texture":[63],"bump":{"position":30,"size":50}}},"typespec":{"name":"Toscain","level":5,"model":8,"code":508,"specs":{"shield":{"capacity":[275,350],"reload":[5,8]},"generator":{"capacity":[75,100],"reload":[35,50]},"ship":{"mass":300,"speed":[80,90],"rotation":[50,80],"acceleration":[80,110]}},"shape":[3.4,3.354,3.556,2.748,2.336,2.055,1.858,1.732,1.634,1.548,1.462,1.404,1.371,1.36,1.241,1.161,1.723,4.485,5.01,4.795,4.111,3.842,3.82,3.753,3.634,3.407,3.634,3.753,3.82,3.842,4.111,4.795,5.01,4.485,1.723,1.161,1.241,1.353,1.371,1.404,1.462,1.548,1.634,1.732,1.858,2.055,2.336,2.748,3.556,3.354],"lasers":[{"x":0,"y":-3.4,"z":0,"angle":0,"damage":[14,30],"rate":1,"type":2,"speed":[150,200],"number":1,"spread":0,"error":0,"recoil":50},{"x":-0.846,"y":-3.454,"z":-0.102,"angle":15,"damage":[3.75,6],"rate":2,"type":1,"speed":[100,130],"number":2,"spread":45,"error":0,"recoil":0},{"x":0.846,"y":-3.454,"z":-0.102,"angle":-15,"damage":[3.75,6],"rate":2,"type":1,"speed":[100,130],"number":2,"spread":45,"error":0,"recoil":0}],"radius":5.01}}';
var ships = [];
for (let ship in a) ships.push(a[ship]);

var vocabulary = [
  {text: "Yes", icon:"\u004c", key:"Y"},
  {text: "No", icon:"\u004d", key:"N"},
  {text: "Defend", icon:"\u0025", key:"D"},
  {text: "Kill", icon:"\u007f", key:"K"},
  {text: "Sorry", icon:"\u00a1", key:"S"},
  {text: "Thanks", icon:"\u0041", key:"X"},
  {text: "You", icon:"\u004e", key:"O"},
  {text: "Me", icon:"\u004f", key:"E"},
  {text: "No Problem", icon:"\u0047", key:"P"},
  {text: "Attack", icon:"\u0049", key:"A"},
  {text: "Help", icon:"\u004a", key:"H"},
  {text: "Hmmm?", icon:"\u004b", key:"Q"},
  {text: "GoodGame", icon:"\u00a3", key:"G"},
  {text: "Wait", icon:"\u0048", key:"T"},
  {text: "Base", icon:"\u0034", key:"B"},
  {text: "Follow", icon:"\u0050", key:"F"},
  {text: "Why?", icon:"KK", key:"I"},
  {text: "Love", icon:"\u0024", key:"L"},
  {text: "Bruh", icon:"˙ ͜ʟ˙", key:"M"},
  {text: "WTF", icon:"ಠ_ಠ", key:"W"}
];

var ships_list = [
  ["Pulse-Fighter","Side-Fighter","Shadow-X-1","Y-Defender"],
  ["Vanguard","Mercury","X-Warrior","Side-Interceptor","Pioneer","Crusader"],
  ["U-Sniper","FuryStar","T-Warrior","Aetos","Shadow X-2","Howler","Bat-Defender","Toscain"],
  ["Advanced-Fighter","Scorpion","Marauder","Condor","A-Speedster","Rock-Tower","Baracuda","O-Defender","H-Mercury"],
  ["Odyssey","Shadow X-3","Bastion","Aries"]
];

function findShipCode(name){
  for (let i=0;i<ships_list.length;i++)
  for (let j=0;j<ships_list[i].length;j++)
  if (ships_list[i][j] == name) return (i+3)*100+j+1;
  return null;
}

function shuffle(array,yeetus){
  var tmp, current, top = array.length;
  if (top) while(--top){
    current = Math.floor(Math.random()*(top+1));
    tmp = array[current];
    array[current] = array[top];
    array[top] = tmp;
  }
  if (yeetus) return array.slice(0,yeetus);
  return array;
}

function getRandByRatio(tierratio){
  let idx = Math.floor(Math.random()*101);
  for (let item of tierratio){
    if (idx >= item.r[0] && idx <= item.r[1]) return item.t;
  }
}

var chooseships,maps = [1761,1749,77,45,4360,3604,5575,4990],music = ["warp_drive.mp3","crystals.mp3","argon.mp3"],
tierratio = [{t:3,r:[0,6]},{t:4,r:[7,16]},{t:5,r:[17,41]},{t:6,r:[42,74]},{t:7,r:[75,100]}/*6,17,25,33,17*/];
var colors = [
  {team:"Red",hue:0,team2:"Blue",hue2:240},
  {team:"Yellow",hue:60,team2:"Pink",hue2:300},
  {team:"Green",hue:120,team2:"Purple",hue2:270},
  {team:"Aqua",hue:150,team2:"Orange",hue2:30}
];
if (!game.custom.initialized){
  game.custom.initialized = true;
  game.custom.kicked_ids = [];
  if (modifier.friendly_fire == "random") modifier.friendly_fire = Math.floor(Math.random() * 10) === 0;
  if (modifier.round_ship_tier === "random") modifier.round_ship_tier = getRandByRatio(tierratio);
  var tier = modifier.round_ship_tier,ship_name,rand_ships,ship_choices = 4;
  switch (modifier.round_ship_tier){
    case 3:
    case 4:
      ship_choices = 3;
      break;
    case 5:
      ship_choices = 3;
      break;
    case 7:
      ship_choices = false;
    break;
  }
  ship_name = JSON.parse(JSON.stringify(ships_list[tier-3]));
  rand_ships = JSON.parse(JSON.stringify(ships_list[tier-3])).map((n,p) => tier*100+p+1);
  chooseships = shuffle(rand_ships,ship_choices);
  shuffle(colors,false);
  colors = colors[0];
  game.custom.colors = colors;
  game.custom.ship_name = ship_name;
  game.custom.modifier = modifier;
}
colors = game.custom.colors;
modifier = game.custom.modifier;
var ship_name = game.custom.ship_name;
var teams = {
  names: [colors.team,colors.team2],
  points: [0,0],
  count: [0,0],
  ships: [[],[]],
  hues: [colors.hue,colors.hue2]
};

var maps = [
  {name: "Dimension", author: "Liberal", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "99                                                        99\n"+
    "99                                                        99\n"+
    "99  9999999999999999999999999999999999999999999999999999  99\n"+
    "99  9999999999999999999999999999999999999999999999999999  99\n"+
    "99  9999999999999999999999999999999999999999999999999999  99\n"+
    "99  99999999999999999999999      99999999999999999999999  99\n"+
    "99  9999999999999999999999        9999999999999999999999  99\n"+
    "99  999999999999999999999          999999999999999999999  99\n"+
    "99  99999999999999999999            99999999999999999999  99\n"+
    "99  9999999999999999999     9999     9999999999999999999  99\n"+
    "99  99999999999999999                  99999999999999999  99\n"+
    "99  9999999999999999                    9999999999999999  99\n"+
    "99  99999 999999999                      999999999 99999  99\n"+
    "99  9999   9999999                        9999999   9999  99\n"+
    "99  999     99999        7997  7997        99999     999  99\n"+
    "99  99       999                            999       99  99\n"+
    "99  99        9    7                    7    9        99  99\n"+
    "99  99             9                    9             99  99\n"+
    "99  99             9                    9             99  99\n"+
    "99  99   7         7   99997    79999   7         7   99  99\n"+
    "99  99   99           99            99           99   99  99\n"+
    "99  99    99          7              7          99    99  99\n"+
    "99  99     99                                  99     99  99\n"+
    "99  99      99                                99      99  99\n"+
    "99  99      999   97                    79   999      99  99\n"+
    "99  99      9799 99        7    7        99 9979      99  99\n"+
    "99  99      977999        99    99        999779      99  99\n"+
    "99  99      97779        99      99        97779      99  99\n"+
    "99  99      97779        99      99        97779      99  99\n"+
    "99  99      977999        99    99        999779      99  99\n"+
    "99  99      9799 99        7    7        99 9979      99  99\n"+
    "99  99      999   97                    79   999      99  99\n"+
    "99  99      99                                99      99  99\n"+
    "99  99     99                                  99     99  99\n"+
    "99  99    99          7              7          99    99  99\n"+
    "99  99   99           99            99           99   99  99\n"+
    "99  99   7         7   99997    79999   7         7   99  99\n"+
    "99  99             9                    9             99  99\n"+
    "99  99             9                    9             99  99\n"+
    "99  99        9    7                    7    9        99  99\n"+
    "99  99       999                            999       99  99\n"+
    "99  999     99999        7997  7997        99999     999  99\n"+
    "99  9999   9999999                        9999999   9999  99\n"+
    "99  99999 999999999                      999999999 99999  99\n"+
    "99  9999999999999999                    9999999999999999  99\n"+
    "99  99999999999999999                  99999999999999999  99\n"+
    "99  9999999999999999999     9999     9999999999999999999  99\n"+
    "99  99999999999999999999            99999999999999999999  99\n"+
    "99  999999999999999999999          999999999999999999999  99\n"+
    "99  9999999999999999999999        9999999999999999999999  99\n"+
    "99  99999999999999999999999      99999999999999999999999  99\n"+
    "99  9999999999999999999999999999999999999999999999999999  99\n"+
    "99  9999999999999999999999999999999999999999999999999999  99\n"+
    "99  9999999999999999999999999999999999999999999999999999  99\n"+
    "99                                                        99\n"+
    "99                                                        99\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:-210,y:0},{x:210,y:0}],
  radar: {type:"box",width:10,height:18},
  basedmg: [{x:-185,x2:-230,y:40,y2:-40},{x:185,x2:230,y:40,y2:-40}]
  },
  {name: "Waves", author: "Kirito", map:
    "9999                 99999        99999                 9999\n"+
    "9999     5           99999        99999           5     9999\n"+
    "9999    77 8        99999997    79999999        8 77    9999\n"+
    "9999    89996     66999999        99999966     69998    9999\n"+
    "9999    99999        99999        99999        99999    9999\n"+
    "9999   9999999       999995      599999       9999999   9999\n"+
    "9999  699999996      9999          9999      699999996  9999\n"+
    "9999    99999        9999          9999        99999    9999\n"+
    "99999   99999        9997          7999        99999   99999\n"+
    "999996  99997       7999            9997       79999  699999\n"+
    "999     9999        9999            9999        9999     999\n"+
    "998     9997      6 99997          79999 6      7999     899\n"+
    "99     9999         9999            9999         9999     99\n"+
    "99     9999        79998            89997        9999     99\n"+
    "99    799997        9997   6    6   7999        799997    99\n"+
    "99     9999         799    7    7    997         9999     99\n"+
    "99     9999          9     9    9     9          9999     99\n"+
    "99      9997         7    79    97    7         7999      99\n"+
    "99      9999              99    99              9999      99\n"+
    "998     9999             799    997             9999     899\n"+
    "999     9999 6           999    999           6 9999     999\n"+
    "999     99997            999    999            79999     999\n"+
    "999     79999         6  999    999  6         99997     999\n"+
    "9998     9999           6999    9996           9999     8999\n"+
    "9998     9999           9999    9999           9999     8999\n"+
    "999     799997         6999      9996         799997     999\n"+
    "998      9999          6999      9996          9999      899\n"+
    "99        99          6999 5    5 9996          99        99\n"+
    "99                    999          999                    99\n"+
    "98                    999          999                    89\n"+
    "98                    999          999                    89\n"+
    "99                    999          999                    99\n"+
    "99        99          6999 5    5 9996          99        99\n"+
    "998      9999          6999      9996          9999      899\n"+
    "999     799997         6999      9996         799997     999\n"+
    "9998     9999           9999    9999           9999     8999\n"+
    "9998     9999           6999    9996           9999     8999\n"+
    "999     79999         6  999    999  6         99997     999\n"+
    "999     99997            999    999            79999     999\n"+
    "999     9999 6           999    999           6 9999     999\n"+
    "998     9999             799    997             9999     899\n"+
    "99      9999              99    99              9999      99\n"+
    "99      9997         7    79    97    7         7999      99\n"+
    "99     9999          9     9    9     9          9999     99\n"+
    "99     9999         799    7    7    997         9999     99\n"+
    "99    799997        9997   6    6   7999        799997    99\n"+
    "99     9999        79998            89997        9999     99\n"+
    "99     9999         9999            9999         9999     99\n"+
    "998     9997      6 99997          79999 6      7999     899\n"+
    "999     9999        9999            9999        9999     999\n"+
    "999996  99997       7999            9997       79999  699999\n"+
    "99999   99999        9997          7999        99999   99999\n"+
    "9999    99999        9999          9999        99999    9999\n"+
    "9999  699999996      9999          9999      699999996  9999\n"+
    "9999   9999999       999995      599999       9999999   9999\n"+
    "9999    99999        99999        99999        99999    9999\n"+
    "9999    89996     66999999        99999966     69998    9999\n"+
    "9999    77 8        99999997    79999999        8 77    9999\n"+
    "9999     5           99999        99999           5     9999\n"+
    "9999                 99999        99999                 9999",
  shipspawn: [{x:-120,y:0},{x:120,y:0}],
  radar: {type:"box",width:10,height:20},
  basedmg: [{x:-140,x2:-100,y:-50,y2:50},{x:100,x2:140,y:-50,y2:50}]
  },
  {name: "Slides", author: "Healer", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "9          999999999999999999  999999999999999999          9\n"+
    "9  9999999999              99  999     999     999   999   9\n"+
    "9 99999999                  9  9999     999     999   999  9\n"+
    "9 999                       9  99999     999     999   999 9\n"+
    "9 99                    9   9  9 9999     999     999   99 9\n"+
    "9 99          9        99   9  9  9999     999     999   9 9\n"+
    "9 99         99       999   9  9   9999     999     999    9\n"+
    "9 99        99       999    9  9    9999     999     999   9\n"+
    "9 99       999      999     9  9     9999     999     999  9\n"+
    "9 9       999      999      9  9      9999     999     999 9\n"+
    "9 9      999      999       9999       9999     999     99 9\n"+
    "999     999      999         9999       9999     999     999\n"+
    "99     999                    9999       9999     999     99\n"+
    "99    99      99               9999       9999     999    99\n"+
    "99            99                9999       9999     999   99\n"+
    "99                               9999       9999     999  99\n"+
    "99          9                     9999       9999     999 99\n"+
    "99         99        9999          9999       9999     99999\n"+
    "99        999       9999            9999       9999     9999\n"+
    "99       999       9999              9999       9999     999\n"+
    "99      999       9999                9999       9999     99\n"+
    "99     999        999                  9999       9999    99\n"+
    "99    999         99        9999        9999       9999   99\n"+
    "99   999          9                      9999       9999  99\n"+
    "99                                        9999       9999 99\n"+
    "99                                         9999       999999\n"+
    "999                        9    9           9999       99999\n"+
    "999999999999           9    9  9    9        999999999999999\n"+
    "          999          9     99     9         9999          \n"+
    "          9999         9     99     9          999          \n"+
    "999999999999999        9    9  9    9           999999999999\n"+
    "99999       9999           9    9                        999\n"+
    "999999       9999                                         99\n"+
    "99 9999       9999                                        99\n"+
    "99  9999       9999                      9          999   99\n"+
    "99   9999       9999        9999        99         999    99\n"+
    "99    9999       9999                  999        999     99\n"+
    "999    9999       9999                9999       999      99\n"+
    "9999    9999       9999              9999       999       99\n"+
    "99999    9999       9999            9999       999        99\n"+
    "999999    9999       9999          9999        99         99\n"+
    "99 9999    9999       9999                     9          99\n"+
    "99  9999    9999       9999                               99\n"+
    "99   9999    9999       9999                99            99\n"+
    "99    9999    9999       9999               99      99    99\n"+
    "999    9999    9999       9999                    999     99\n"+
    "9999    9999    9999       9999         999      999     999\n"+
    "99999    9999    9999       9999       999      999      9 9\n"+
    "9 9999    9999    9999      9999      999      999       9 9\n"+
    "9  9999    9999    9999     9999     999      999       99 9\n"+
    "9   9999    9999    9999    9  9    999       99        99 9\n"+
    "9    9999    9999    9999   9  9   999       99         99 9\n"+
    "9 9   9999    9999    9999  9  9   99        9          99 9\n"+
    "9 99   9999    9999    9999 9  9   9                    99 9\n"+
    "9 999   9999    9999    99999  9                       999 9\n"+
    "9  999   9999    9999    9999  9                  99999999 9\n"+
    "9   999   9999    9999    999  99              9999999999  9\n"+
    "9          999999999999999999  999999999999999999          9\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:-220,y:220},{x:220,y:-220}],
  radar: {type:"box",width:8,height:8},
  basedmg: [{x:-200,x2:-235,y:200,y2:240},{x:200,x2:235,y:-200,y2:-240}]
  },
  {name: "Rammer's Paradise", author: "Destroy", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999                  999999999999999999999\n"+
    "99999999999999999999                    99999999999999999999\n"+
    "999999999999999  999                    999  999999999999999\n"+
    "999999999999999  999                    999  999999999999999\n"+
    "99999999999999999999                    99999999999999999999\n"+
    "99999999999999999999     9        9     99999999999999999999\n"+
    "99999999999999999999     999    999     99999999999999999999\n"+
    "99999999999               99    99             9999999999999\n"+
    "9999999999                99    99              999999999999\n"+
    "999999999                 99    99                 999999999\n"+
    "99999                  9999      9999                  99999\n"+
    "9999           99      9            9      99           9999\n"+
    "9999            9     99            99     9            9999\n"+
    "9999  9999      99999999            99999999      9999  9999\n"+
    "9999            9      9            9      9            9999\n"+
    "9999            9      9999      9999      9            9999\n"+
    "99999           9       9          9       9           99999\n"+
    "99999999999     9       9          9       9     99999999999\n"+
    "99999999999     9       9          9       9     99999999999\n"+
    "999999  999     9       9          9      99     999  999999\n"+
    "999999  999     99      9          9             999  999999\n"+
    "99999999999             9          9             99999999999\n"+
    "99999999999             9          9             99999899999\n"+
    "9999999                 9          9                 9999999\n"+
    "999999                 9999      9999                 999999\n"+
    "999999                 9            9                 999999\n"+
    "999999     9           9            9           9     999999\n"+
    "999999     9    99     9            9     99    9     999999\n"+
    "999999     9    9      9            9      9    9     999999\n"+
    "999999     9    9      9            9      9    9     999999\n"+
    "999999          9      99          99      9          999999\n"+
    "999999          9                          9          999999\n"+
    "9999999         9                          9         9999999\n"+
    "99999999999     9                          9     99999999999\n"+
    "99999999999     999999999          999999999     99999999999\n"+
    "999999  999     9      9            9      9     999  999999\n"+
    "999999  999            9            9            999  999999\n"+
    "99999999999            9            9            99999999999\n"+
    "99999999999            9            9            99999999999\n"+
    "99999                  9            9                  99999\n"+
    "9999                   99          99                   9999\n"+
    "9999                   9999      9999                   9999\n"+
    "9999            9      9            9      9            9999\n"+
    "9999   99999    99999999            99999999    99999   9999\n"+
    "9999            9      9            9      9            9999\n"+
    "9999                   9            9                   9999\n"+
    "9999                   9999      9999                   9999\n"+
    "99999                    99      99                    99999\n"+
    "9999999999999            999    999            9999999999999\n"+
    "99999999999999999999      99    99      99999999999999999999\n"+
    "999999999999999999999      9    9      999999999999999999999\n"+
    "999999999999999999999                  999999999999999999999\n"+
    "9999999999999999  999                  999  9999999999999999\n"+
    "9999999999999999  999                  999  9999999999999999\n"+
    "999999999999999999999                  999999999999999999999\n"+
    "9999999999999999999999                9999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:0,y:-255},{x:0,y:255}],
  radar: {type:"box",width:13,height:7},
  basedmg: [{x:-30,x2:30,y:-240,y2:-270},{x:-30,x2:30,y:240,y2:270}]
  },
  {name: "Barriers", author: "Healer", map:
    "9999999999       9999999999      9999999999       9999999999\n"+
    "99999999999                                      99999999999\n"+
    "9         99                                    99         9\n"+
    "9 9999999999   9999999999999    9999999999999   9999999999 9\n"+
    "9 9       99                                    99       9 9\n"+
    "9 9        9                                    9        9 9\n"+
    "9 9                                                      9 9\n"+
    "9 9                                                      9 9\n"+
    "9 9                                                      9 9\n"+
    "9 9      99       999999            999999       99      9 9\n"+
    "9 9     999         99                99         999     9 9\n"+
    "9 9   99999                                      99999   9 9\n"+
    "9 9   999                                          999   9 9\n"+
    "999   999                                          999   999\n"+
    "9     999                                          999     9\n"+
    "9      99                                          99      9\n"+
    "9      99                                          99      9\n"+
    "9     999                                          999     9\n"+
    "9    9999                                          9999    9\n"+
    "9     99                                            99     9\n"+
    "9  9   9                                            9   9  9\n"+
    "9 999       9999999                      9999999       999 9\n"+
    "9 999                                                  999 9\n"+
    "9999                        9  9                        9999\n"+
    "999                        99  99                        999\n"+
    "99         99                                  99         99\n"+
    "99         9                                    9         99\n"+
    "99         9      9                      9      9         99\n"+
    "99         9      9                      9      9         99\n"+
    "99         9      9                      9      9         99\n"+
    "99         9      9                      9      9         99\n"+
    "99         9      9                      9      9         99\n"+
    "99         9      9                      9      9         99\n"+
    "99         9                                    9         99\n"+
    "99         99                                  99         99\n"+
    "999                        99  99                        999\n"+
    "9999                        9  9                        9999\n"+
    "9 999                                                  999 9\n"+
    "9 999       9999999                      9999999       999 9\n"+
    "9  9   9                                            9   9  9\n"+
    "9     99                                            99     9\n"+
    "9    9999                                          9999    9\n"+
    "9     999                                          999     9\n"+
    "9      99                                          99      9\n"+
    "9      99                                          99      9\n"+
    "9     999                                          999     9\n"+
    "999   999                                          999   999\n"+
    "9 9   999                                          999   9 9\n"+
    "9 9   99999                                      99999   9 9\n"+
    "9 9     999         99                99         999     9 9\n"+
    "9 9      99       999999            999999       99      9 9\n"+
    "9 9                                                      9 9\n"+
    "9 9                                                      9 9\n"+
    "9 9                                                      9 9\n"+
    "9 9        9                                    9        9 9\n"+
    "9 9       99                                    99       9 9\n"+
    "9 9999999999   9999999999999    9999999999999   9999999999 9\n"+
    "9         99                                    99         9\n"+
    "99999999999                                      99999999999\n"+
    "9999999999       9999999999      9999999999       9999999999",
  shipspawn: [{x:-235,y:0},{x:235,y:0}],
  radar: {type:"box",width:10,height:14},
  basedmg: [{x:-210,x2:-253,y:35,y2:-35},{x:210,x2:253,y:35,y2:-35}]
  },
  {name: "Heartache", author: "GumZ", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "997599999999999999995999999999999999999599999999999999995799\n"+
    "97 7999999999999975  599999999999999995  5799999999999997 79\n"+
    "957999999999999999975 9997  7997  7999 579999999999999999759\n"+
    "9999999977999999999997979    77    9797999999999997799999999\n"+
    "9999999     7999999999997          7999999999997     9999999\n"+
    "999999  77    99999999999          99999999999    77  999999\n"+
    "99999  7995   799999999999        999999999997   5997  99999\n"+
    "99997 7997     75 999999997      799999999 57     7997 79999\n"+
    "99997 797          999999997    799999999          797 79999\n"+
    "99999  5          3 999999997  799999999 3          5  99999\n"+
    "99999                999999997799999999                99999\n"+
    "999999               999999999999999999               999999\n"+
    "9999995             79999999999999999997             5999999\n"+
    "999999      5       577 799999999997 775       5      999999\n"+
    "999999     7             9999999999             7     999999\n"+
    "999997     99            7999999997   3        99     799999\n"+
    "999995    5997        7   99999999            7995    599999\n"+
    "999995     999            79999997            999     599999\n"+
    "999997     7997           79999997           7997     799999\n"+
    "999999      99             999999             99      999999\n"+
    "9999995     9  7           799997           7  9     5999999\n"+
    "9999997     6  9            5  5            9  6     7999999\n"+
    "9999997       99                            99       7999999\n"+
    "999997        997         7      7         799        799999\n"+
    "99997        6999          5    5          9996        79999\n"+
    "99997      3 7999                          9997 3      79999\n"+
    "9999         9999   7                      9999         9999\n"+
    "9997        797797 597                    797797        7999\n"+
    "9995       598  99  7                     99  895       5999\n"+
    "9995       598  99                     7  99  895       5999\n"+
    "9997        797797                    795 797797        7999\n"+
    "9999         9999                      7   9999         9999\n"+
    "99997      3 7999                          9997 3      79999\n"+
    "99997        6999          5    5          9996        79999\n"+
    "999997        997         7      7         799        799999\n"+
    "9999997       79                            99       7999999\n"+
    "9999997     6  9            5  5            9  6     7999999\n"+
    "9999995     9  7           799997           7  9     5999999\n"+
    "999999      97             999999             99      999999\n"+
    "999997     7997           79999997           7997     799999\n"+
    "999995     999            79999997            999     599999\n"+
    "999995    5997            99999999            7995    599999\n"+
    "999997     99        6   7999999997            99     799999\n"+
    "999999     7             9999999999             7     999999\n"+
    "999999      5       577 799999999997 775       5      999999\n"+
    "9999995             79999999999999999997             5999999\n"+
    "999999               999999999999999999               999999\n"+
    "99999                999999997799999999                99999\n"+
    "99999  5          3 999999997  799999999 3          5  99999\n"+
    "99997 797          999999997    799999999       4  797 79999\n"+
    "99997 7997     75 999999997      799999999 57     7997 79999\n"+
    "99999  7995   799999999999        999999999997   5997  99999\n"+
    "999999  77    99999999999          99999999999    77  999999\n"+
    "9999999     7999999999997          7999999999997     9999999\n"+
    "9999999977999999999997979    77    9797999999999997799999999\n"+
    "957999999999999999975 9997  7997  7999 579999999999999999759\n"+
    "97 7999999999999975  599999999999999995  5799999999999997 79\n"+
    "997599999999999999995999999999999999999599999999999999995799\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:-225,y:0},{x:225,y:0}],
  radar: {type:"box",width:10,height:14},
  basedmg: [{x:-190,x2:-235,y:30,y2:-30},{x:190,x2:235,y:30,y2:-30}]
  },
  {name: "Angles", author: "Paindemic", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "99999999999 555555 599    99999999    595 555555 99999999999\n"+
    "999      99 59995 599    999    999    595 59995 995 5 5 999\n"+
    "999      99 5995 599    999      999    595 5995 9955 5 5999\n"+
    "999      99 595 599    999        999    595 595 9999995 999\n"+
    "999       99 5 599    999          999    595 555999999 5999\n"+
    "999        99 599    999            999    595 595   995 999\n"+
    "999         9999    999              999999999595 5  9955999\n"+
    "999999       9      99                9999999995 595 9999999\n"+
    "9999999             9                  9999999995 5 59999999\n"+
    "99    99                                       595 595    99\n"+
    "995555 99                                       595955555599\n"+
    "9959995 99                                       995 5999599\n"+
    "995995 59                                        9995 599599\n"+
    "99595 599                                        99995 59599\n"+
    "9955 599                                         999595 5599\n"+
    "995 599                   999999999              999 595 599\n"+
    "99 599                     99999999              999  595 99\n"+
    "99599                       9999999              999   59599\n"+
    "9999    999                      99              999    5999\n"+
    "999    999                       99               999    599\n"+
    "99    999                        99                999    99\n"+
    "99   999         9999999         9999999            999   99\n"+
    "99  999           9999999         999999             999  99\n"+
    "99 999               9999          9999               999 99\n"+
    "99999                 99            99                 99999\n"+
    "9999                  99            99                  9999\n"+
    "999                   99            99                   999\n"+
    "999999999      999999999            999999999      999999999\n"+
    "9999999999     999999999            999999999     9999999999\n"+
    "999                   99            99                   999\n"+
    "9999                  99            99                  9999\n"+
    "99999                 99            99                 99999\n"+
    "99 999               9999          9999               999 99\n"+
    "99  999             999999         9999999           999  99\n"+
    "99   999            9999999         9999999         999   99\n"+
    "99    999                99                        999    99\n"+
    "995    999               99                       999    999\n"+
    "9995    999              99                      999    9999\n"+
    "99595   999              9999999                       99599\n"+
    "99 595  999              99999999                     995 99\n"+
    "995 595 999              999999999                   995 599\n"+
    "9955 595999                                         995 5599\n"+
    "99595 59999                                        995 59599\n"+
    "995995 5999                                        95 599599\n"+
    "9959995 595                                       99 5999599\n"+
    "995555559595                                       99 555599\n"+
    "99    595 595                                       99    99\n"+
    "99999995 5 5959999999                  9             9999999\n"+
    "9999999 595 5999999999                99      9       999999\n"+
    "9995599  5 599999999999              999    9999         999\n"+
    "999 599   595 595    999            999    995 99        999\n"+
    "9995 999999555 595    999          999    995 5 99       999\n"+
    "999 5999999 595 595    999        999    995 595 99      999\n"+
    "9995 5 5599 5995 595    999      999    995 5995 99      999\n"+
    "999 5 5 599 59995 595    999    999    995 59995 99      999\n"+
    "99999999999 555555 595    99999999    995 555555 99999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:-240,y:240},{x:240,y:-240}],
  radar: {type:"box",width:8,height:8},
  basedmg: [{x:-220,x2:-260,y:220,y2:260},{x:220,x2:260,y:-220,y2:-260}]
  },
  {name: "Butterfly", author: "Healer", map:
    "  999999  9999999    9999999    9999999    9999999  999999  \n"+
    "    9999999999  999999   9999999999   999999  9999999999    \n"+
    "9          99    999      9      9      999    99          9\n"+
    "9           9     99      9      9      99     9           9\n"+
    "99                                                        99\n"+
    "99                                                        99\n"+
    "99                      9          9                      99\n"+
    "99                     999        999                     99\n"+
    " 9        999         9999        9999         999        9 \n"+
    " 9        99            99        99            99        9 \n"+
    "99      999             99        99             999      99\n"+
    "999     99              99        99              99     999\n"+
    "9999    9              99          99              9    9999\n"+
    "99                    99            99                    99\n"+
    "9                    99              99                    9\n"+
    "9                   99                99                   9\n"+
    "99                 99                  99                 99\n"+
    " 9                 99                  99                 9 \n"+
    " 9                  9                  9                  9 \n"+
    " 9                                                        9 \n"+
    " 9            99                            99            9 \n"+
    " 99           9 9                          9 9           99 \n"+
    "  99    9       9                          9       9    99  \n"+
    "   99  99  99  99                          99  99  99  99   \n"+
    "    99999   9999                            9999   99999    \n"+
    " 9999  9                                            9  9999 \n"+
    "9999  99                                            99  9999\n"+
    "9    99                     9  9                     99    9\n"+
    "99  99                     99  99                     99  99\n"+
    " 999 9                                                9 999 \n"+
    " 999 9                                                9 999 \n"+
    "99  99                     99  99                     99  99\n"+
    "9    99                     9  9                     99    9\n"+
    "9999  99                                            99  9999\n"+
    " 9999  9                                            9  9999 \n"+
    "    99999   9999                            9999   99999    \n"+
    "   99  99  99  99                          99  99  99  99   \n"+
    "  99    9       9                          9       9    99  \n"+
    " 99           9 9                          9 9           99 \n"+
    " 9            99                            99            9 \n"+
    " 9                                                        9 \n"+
    " 9                  9                  9                  9 \n"+
    " 9                 99                  99                 9 \n"+
    "99                 99                  99                 99\n"+
    "9                   99                99                   9\n"+
    "9                    99              99                    9\n"+
    "99                    99            99                    99\n"+
    "9999    9              99          99              9    9999\n"+
    "999     99              99        99              99     999\n"+
    "99      999             99        99             999      99\n"+
    " 9        99            99        99            99        9 \n"+
    " 9        999         9999        9999         999        9 \n"+
    "99                     999        999                     99\n"+
    "99                      9          9                      99\n"+
    "99                                                        99\n"+
    "99                                                        99\n"+
    "9           9     99      9      9      99     9           9\n"+
    "9          99    999      9      9      999    99          9\n"+
    "    9999999999  999999   9999999999   999999  9999999999    \n"+
    "  999999  9999999    9999999    9999999    9999999  999999  ",
  shipspawn: [{x:0,y:-250},{x:0,y:250}],
  radar: {type:"box",width:10,height:10},
  basedmg: [{x:25,x2:-25,y:-215,y2:-255},{x:25,x2:-25,y:215,y2:255}]
  },
  {name: "Duality", author: "crispybreads", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "99                 99999                                  99\n"+
    "99                99999                                   99\n"+
    "99                999                                     99\n"+
    "99                99                                      99\n"+
    "99                88                                      99\n"+
    "99                99                                      99\n"+
    "99            999999                                      99\n"+
    "99         99999999           99999989  9999              99\n"+
    "99        999999             99999999   9999999           99\n"+
    "99       9999                 9999999   999999999         99\n"+
    "99       999                             99999999         99\n"+
    "99       99                                9999999        99\n"+
    "99      999                                  99999        99\n"+
    "99      999                                   9999        99\n"+
    "99      99                                    99999       99\n"+
    "99     999                   9999999           9999       99\n"+
    "99 9999999                  99999999999        9999       99\n"+
    "999999999                   9999988888899       999       99\n"+
    "99999                       9999887777889                 99\n"+
    "9999                        99988776677889                99\n"+
    "9999                       999987766667789      9         99\n"+
    "999                        999987665566789      999       99\n"+
    "99                         9999876655667899     999       99\n"+
    "99                        99999877666677899     999       99\n"+
    "99                       999999887766778899     999       99\n"+
    "99                    999999999988777788999     999       99\n"+
    "99                9999999999999998888889999     999       99\n"+
    "99        9      99999999999999999999999999     999       99\n"+
    "99       999     99999999999999999999999999      9        99\n"+
    "99       999     9999888888999999999999999                99\n"+
    "99       999     999887777889999999999                    99\n"+
    "99       999     998877667788999999                       99\n"+
    "99       999     99877666677899999                        99\n"+
    "99       999     9987665566789999                         99\n"+
    "99       999      987665566789999                        999\n"+
    "99         9      987766667789999                       9999\n"+
    "99                98877667788999                        9999\n"+
    "99                 9887777889999                       99999\n"+
    "99       999       9988888899999                   998999999\n"+
    "99       9999        99999999999                  9988999 99\n"+
    "99       8999           9999999                   998     99\n"+
    "99       99999                                    98      99\n"+
    "99        9999                                   998      99\n"+
    "99        99999                                  999      99\n"+
    "99        9999999                                99       99\n"+
    "99         99999999                             999       99\n"+
    "99         999999999   9999999                 9999       99\n"+
    "99           9999999   99999999             999999        99\n"+
    "99              9999  99999999           99999999         99\n"+
    "99                                      999889            99\n"+
    "99                                      99                99\n"+
    "99                                      88                99\n"+
    "99                                      99                99\n"+
    "99                                     999                99\n"+
    "99                                   99999                99\n"+
    "99                                  99999                 99\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:-220,y:-220},{x:220,y:220}],
  radar: {type:"box",width:12,height:12},
  basedmg: [{x:-190,x2:-250,y:-190,y2:-250},{x:190,x2:250,y:190,y2:250}]
  },
  {name: "Dominus", author: "SChickenMan", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "9     999999999999999999999999999999                       9\n"+
    "9 999999                          999                      9\n"+
    "9 9  99                            9999999999999999999999  9\n"+
    "9 9 99                              999999999999999999999  9\n"+
    "9 999                                99                99  9\n"+
    "9999        9999999999999999999       99               99  9\n"+
    "999          9999999999999999999       99999999999999  99  9\n"+
    "99                        999999             99     9  99  9\n"+
    "99                         99999              9     9  99  9\n"+
    "99                          9999              9999  9  99  9\n"+
    "99                           999              99 9  9  99  9\n"+
    "99    9                       999999999999     999  9  99  9\n"+
    "99    99     99999             9999999999       99999  99  9\n"+
    "99    99     99  99                  999           99  99  9\n"+
    "99    99     9 99 99                999             9  99  9\n"+
    "99    99     9 999 99              999              9  99  9\n"+
    "99    99     99 999 99            999               9  99  9\n"+
    "99    99      99 999 99          999 9         9    9  99  9\n"+
    "99    99       99 999 99        99999         99    9  99  9\n"+
    "99    99        99 999 9       99999         999    99 99  9\n"+
    "99    99         99 99 9       9999         9999     9999  9\n"+
    "99    99          99  999      999       9 99999      999  9\n"+
    "99    99           9999999              9 999 99       999 9\n"+
    "99    99              9999             99999  99        9999\n"+
    "99    99               9999           99999   99         999\n"+
    "99    999                99          99999    99          99\n"+
    "99    9999                 9         9999     99          99\n"+
    "99    99999                          999      9999999     99\n"+
    "99    999999                                   9999999    99\n"+
    "99    9999999                                   999999    99\n"+
    "99     9999999      999                          99999    99\n"+
    "99          99     9999         9                 9999    99\n"+
    "99          99    99999          99                999    99\n"+
    "999         99   99999           9999               99    99\n"+
    "9999        99  99999             999999            99    99\n"+
    "9 999       99 999 9              9999999           99    99\n"+
    "9  999      99999 9       999      999  99          99    99\n"+
    "9  9999     9999         9999      99 99 99         99    99\n"+
    "9  99 99    999         99999      99 999 99        99    99\n"+
    "9  99  9    99         99999        99 999 99       99    99\n"+
    "9  99  9    9         9 999          99 999 99      99    99\n"+
    "9  99  9               999            99 999 99     99    99\n"+
    "9  99  9              999              99 999 9     99    99\n"+
    "9  99  9             999                99 99 9     99    99\n"+
    "9  99  99           999                  99  99     99    99\n"+
    "9  99  99999       9999999999             99999     99    99\n"+
    "9  99  9  999     999999999999                       9    99\n"+
    "9  99  9  9 99              999                           99\n"+
    "9  99  9  9999              9999                          99\n"+
    "9  99  9     9              99999                         99\n"+
    "9  99  9     99             999999                        99\n"+
    "9  99  99999999999999       9999999999999999999          999\n"+
    "9  99               99       9999999999999999999        9999\n"+
    "9  99                99                                999 9\n"+
    "9  999999999999999999999                              99 9 9\n"+
    "9  9999999999999999999999                            99  9 9\n"+
    "9                       99                          999999 9\n"+
    "9                       999999999999999999999999999999     9\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:-220,y:220},{x:220,y:-220}],
  radar: {type:"box",width:8,height:8},
  basedmg: [{x:-200,x2:-235,y:200,y2:240},{x:200,x2:235,y:-200,y2:-240}]
  },
  {name: "Speeder's Paradise", author: "little-dino123", map:
    "999999999999999999999999999      999999999999999999999999999\n"+
    "9999999999999999999999999999    9999999999999999999999999999\n"+
    "99999999999999999999999999999  99999999999999999999999999999\n"+
    "99999999999999           9999  9999           99999999999999\n"+
    "9999999999999             99    99             9999999999999\n"+
    "9999999999999              9    9              9999999999999\n"+
    "9999999999999                                  9999999999999\n"+
    "9999999999999                                  9999999999999\n"+
    "999999999999                                    999999999999\n"+
    "99999999999                                      99999999999\n"+
    "9999999999          999999        999999          9999999999\n"+
    "9999999            99999999      99999999            9999999\n"+
    "9999999 999       9999                9999       999 9999999\n"+
    "9999999 9999     9999                  9999     9999 9999999\n"+
    "9999999  9999                                  9999  9999999\n"+
    "999999    999                                  999    999999\n"+
    " 9999                                                  9999 \n"+
    "  99                      9      9                      99  \n"+
    "                         99      99                         \n"+
    "  99                    9999    9999                    99  \n"+
    " 9999      9           999999  999999           9      9999 \n"+
    "999999     99     9     99999  99999     9     99     999999\n"+
    "9999999    999   999     999    999     999   999    9999999\n"+
    "9999999    999           99      99           999    9999999\n"+
    "999999     999           9        9           999     999999\n"+
    "99999      99                                  99      99999\n"+
    "9999       9                                    9       9999\n"+
    " 999                                                    999 \n"+
    " 999               9                    9               999 \n"+
    " 999               99                  99               999 \n"+
    " 999               99                  99               999 \n"+
    " 999               9                    9               999 \n"+
    " 999                                                    999 \n"+
    "9999       9                                    9       9999\n"+
    "99999      99                                  99      99999\n"+
    "999999     999           9        9           999     999999\n"+
    "9999999    999           99      99           999    9999999\n"+
    "9999999    999   999     999    999     999   999    9999999\n"+
    "999999     99     9     99999  99999     9     99     999999\n"+
    " 9999      9           999999  999999           9      9999 \n"+
    "  99                    9999    9999                    99  \n"+
    "                         99      99                         \n"+
    "  99                      9      9                      99  \n"+
    " 9999                                                  9999 \n"+
    "999999    999                                  999    999999\n"+
    "9999999  9999                                  9999  9999999\n"+
    "9999999 9999     9999                  9999     9999 9999999\n"+
    "9999999 999       9999                9999       999 9999999\n"+
    "9999999            99999999      99999999            9999999\n"+
    "9999999999          999999        999999          9999999999\n"+
    "99999999999                                      99999999999\n"+
    "999999999999                                    999999999999\n"+
    "9999999999999                                  9999999999999\n"+
    "9999999999999                                  9999999999999\n"+
    "9999999999999              9    9              9999999999999\n"+
    "9999999999999             99    99             9999999999999\n"+
    "99999999999999           9999  9999           99999999999999\n"+
    "99999999999999999999999999999  99999999999999999999999999999\n"+
    "9999999999999999999999999999    9999999999999999999999999999\n"+
    "999999999999999999999999999      999999999999999999999999999",
  shipspawn: [{x:-220,y:0},{x:220,y:0}],
  radar: {type:"box",width:8,height:8},
  basedmg: [{x:-200,x2:-240,y:-20,y2:20},{x:200,x2:240,y:-20,y2:20}]
  },
  {name: "Branches", author: "Healer", map:
    "    995559995999955559999          9999555599995999555995559\n"+
    "     99999999   99999   99        99   99999   9999999959995\n"+
    "      99559              99      99              9559 599595\n"+
    "       999                9      9                9999959995\n"+
    "9         99         99   9      9   99         99     95959\n"+
    "99        99         99   9      9   99         99      9599\n"+
    "599                    9  9      9  9                   9595\n"+
    "5999                   999        999                   9995\n"+
    "5959         9999     99            99      999         9595\n"+
    "9959       999   9    99            99      9 999       9599\n"+
    "999 99     9     9           99                 9     99 999\n"+
    "99  99   999                9999                999   99  99\n"+
    "59       9  9             99    99             9  9       95\n"+
    "9       99   9           9        9         999   99       9\n"+
    "9       9     99         9        9         9 9    9       9\n"+
    "9       9     99          9      9          999   99       9\n"+
    "99      9                                  9              99\n"+
    "59       99                                               95\n"+
    "59                                                        95\n"+
    "59                                                        95\n"+
    "59                                                        95\n"+
    "9     99                                            99     9\n"+
    "9   99  9                                          9  99   9\n"+
    "9   99  9                                          9  99   9\n"+
    "99      999   9                           9  9   999      99\n"+
    " 99    9 99    9             9           9999    99 9    99 \n"+
    "  99999       9             9             9  9       99999  \n"+
    "              9           9 9                9              \n"+
    "             9             99                 9             \n"+
    "             9                                9             \n"+
    "             9                                9             \n"+
    "             9                 99             9             \n"+
    "              9                9 9           9              \n"+
    "  99999       9  9             9             9       99999  \n"+
    " 99    9 99    9999           9             9    99 9    99 \n"+
    "99      999   9  9                           9   999      99\n"+
    "9   99  9                                          9  99   9\n"+
    "9   99  9                                          9  99   9\n"+
    "9     99                                            99     9\n"+
    "59                                                        95\n"+
    "59                                                        95\n"+
    "59                                                        95\n"+
    "59                                               99       95\n"+
    "99              9                                  9      99\n"+
    "9       99   999          9      9          99     9       9\n"+
    "9       9    9 9         9        9         99     9       9\n"+
    "9       99   999         9        9           9   99       9\n"+
    "59       9  9             99    99             9  9       95\n"+
    "99  99   999                9999                999   99  99\n"+
    "999 99     9                 99           9     9     99 999\n"+
    "9959       999 9      99            99    9   999       9599\n"+
    "5959         999      99            99     9999         9595\n"+
    "5999                   999        999                   9995\n"+
    "5959                   9  9      9  9                    995\n"+
    "9959      99         99   9      9   99         99        99\n"+
    "95959     99         99   9      9   99         99         9\n"+
    "5999599999                9      9                999       \n"+
    "59599559559              99      99              95599      \n"+
    "5999599999999   99999   99        99   99999   99999999     \n"+
    "9555995559995999955559999          999955559999599955599    ",
  shipspawn: [{x:-220,y:-220},{x:220,y:220}],
  radar: {type:"box",width:8,height:8},
  basedmg: [{x:-200,x2:-235,y:-200,y2:-240},{x:200,x2:235,y:200,y2:240}]
  },
  {name: "Passages", author: "Healer", map:
    "9   99   999999999   9999999    9999999   999999999   99   9\n"+
    " 999 9999999    9999999   99999999   9999999    9999999 999 \n"+
    " 9 99  9 99      99999     999999     99999      99 9  99 9 \n"+
    " 999 99999                                        99999 999 \n"+
    "9 9 99                                                99 9 9\n"+
    "99 99                   9          9                   99 99\n"+
    " 9 9           99      99          99      99           9 9 \n"+
    " 999            99     9999      9999     99            999 \n"+
    " 9 9             99       99    99       99             9 9 \n"+
    "9999              9        9    9        9              9999\n"+
    "999                        9    9                        999\n"+
    "99                                                        99\n"+
    "9     9                                              9     9\n"+
    "9    99                     9  9                     99    9\n"+
    "9    9      99  99         99  99         99  99      9    9\n"+
    "9    9       9  9                          9  9       9    9\n"+
    "9    9                                                9    9\n"+
    "9    9                                                9    9\n"+
    "9    9                                                9    9\n"+
    "9    9        99           999999           99        9    9\n"+
    "9    99       99         999    999         99       99    9\n"+
    "9     9                                              9     9\n"+
    "9                                                          9\n"+
    "99                                                        99\n"+
    "999                                                      999\n"+
    " 9999                                                  9999 \n"+
    "              999          9    9          999              \n"+
    "             99999        9      9        99999             \n"+
    " 99                         9  9                         99 \n"+
    "                                                            \n"+
    "                                                            \n"+
    " 99                         9  9                         99 \n"+
    "             99999        9      9        99999             \n"+
    "              999          9    9          999              \n"+
    " 9999                                                  9999 \n"+
    "999                                                      999\n"+
    "99                                                        99\n"+
    "9                                                          9\n"+
    "9     9                                              9     9\n"+
    "9    99       99         999    999         99       99    9\n"+
    "9    9        99           999999           99        9    9\n"+
    "9    9                                                9    9\n"+
    "9    9                                                9    9\n"+
    "9    9                                                9    9\n"+
    "9    9       9  9                          9  9       9    9\n"+
    "9    9      99  99         99  99         99  99      9    9\n"+
    "9    99                     9  9                     99    9\n"+
    "9     9                                              9     9\n"+
    "99                                                        99\n"+
    "999                        9    9                        999\n"+
    "9999              9        9    9        9              9999\n"+
    " 9 9             99       99    99       99             9 9 \n"+
    " 999            99     9999      9999     99            999 \n"+
    " 9 9           99      99          99      99           9 9 \n"+
    "99 99                   9          9                   99 99\n"+
    "9 9 99                                                99 9 9\n"+
    " 999 99999                                        99999 999 \n"+
    " 9 99  9 99      99999     999999     99999      99 9  99 9 \n"+
    " 999 9999999    9999999   99999999   9999999    9999999 999 \n"+
    "9   99   999999999   9999999    9999999   999999999   99   9",
  shipspawn: [{x:0,y:-240},{x:0,y:240}],
  radar: {type:"box",width:5,height:5},
  basedmg: [{x:-15,x2:15,y:-235,y2:-265},{x:-15,x2:15,y:235,y2:265}]
  },
  {name: "Parenthesis", author: "EDEN", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999                                                999999\n"+
    "99999                                                  99999\n"+
    "99999                                                  99999\n"+
    "99999            999                    999            99999\n"+
    "99   9            999                  999            9   99\n"+
    "9     9             999              999             9     9\n"+
    "9        9            999          999            9        9\n"+
    "9       99              999      999              99       9\n"+
    "9      999                                        999      9\n"+
    "9                                                          9\n"+
    "9                                                          9\n"+
    "9                     99            99                     9\n"+
    "9                      99          99                      9\n"+
    "9              9        99        99        9              9\n"+
    "9              99        99      99        99              9\n"+
    "9              99         99    99         99              9\n"+
    "9               99        99    99        99               9\n"+
    "9                9        99    99        9                9\n"+
    "9                99       99    99       99                9\n"+
    "9                 9       99    99       9                 9\n"+
    "9                 99      99    99      99                 9\n"+
    "9                  9      99    99      9                  9\n"+
    "9     999999       9      99    99      9       999999     9\n"+
    "9    999999               99    99                   99    9\n"+
    "9   99                   99      99                   99   9\n"+
    "99999                   99        99                   99999\n"+
    "9999                                                    9999\n"+
    "                                                            \n"+
    "                                                            \n"+
    "                                                            \n"+
    "                                                            \n"+
    "9999                                                    9999\n"+
    "99999                   99        99                   99999\n"+
    "9   99                   99      99                   99   9\n"+
    "9    999999               99    99                   99    9\n"+
    "9     999999       9      99    99      9       999999     9\n"+
    "9                  9      99    99      9                  9\n"+
    "9                 99      99    99      99                 9\n"+
    "9                 9       99    99       9                 9\n"+
    "9                99       99    99       99                9\n"+
    "9                9        99    99        9                9\n"+
    "9               99        99    99        99               9\n"+
    "9              99         99    99         99              9\n"+
    "9              99        99      99        99              9\n"+
    "9              9        99        99        9              9\n"+
    "9                      99          99                      9\n"+
    "9                     99            99                     9\n"+
    "9                                                          9\n"+
    "9                                                          9\n"+
    "9      999                                        999      9\n"+
    "9       99              999      999              99       9\n"+
    "9        9            999          999            9        9\n"+
    "9     9             999              999             9     9\n"+
    "99   9            999                  999            9   99\n"+
    "99999            999                    999            99999\n"+
    "99999                                                  99999\n"+
    "99999                                                  99999\n"+
    "999999                                                999999\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:0,y:-250},{x:0,y:250}],
  radar: {type:"box",width:10,height:10},
  basedmg: [{x:-25,x2:25,y:-225,y2:-275},{x:-25,x2:25,y:225,y2:275}]
  },
  {name: "Breakbeat", author: "Robonuko", map:
  "       9999999999999999              9999999999999999       \n"+
  "   9 9 99            999                           99999999 \n"+
  "   9 9 99             999                          99     9 \n"+
  " 999 9 99              999                         999999 9 \n"+
  " 9   9 99               9999999999999999999       99    9 9 \n"+
  " 9 999 99   999999999    999999999999999999      999999 9 9 \n"+
  " 9 9   99   9999999999         999  9  999      9999999 9 9 \n"+
  " 9 9 9999           999       999  9  999            99 9 9 \n"+
  " 9 9 9999            99      99999999999             99 9 9 \n"+
  " 9 9 99               9     99999999999        9     9999 9 \n"+
  " 9 9 99       99                          9   99      999 9 \n"+
  " 9 9 99       99                         99   99       9999 \n"+
  "   9 99       99                        999   99999     999 \n"+
  "   9 99       99   9                          9999       999\n"+
  "9    99   999999   99        9999                         99\n"+
  "99   99   999999               99                          9\n"+
  "999  99                         9    99999                  \n"+
  " 999 99                         9   999999   999            \n"+
  "  99999                      9          99   99      9      \n"+
  "  99999      99       9      99         99   9       99     \n"+
  "  99999       9      99      999        99           999    \n"+
  "  99 99             999       9999999   9        9   9999   \n"+
  "  99  9            999         999999           99   99999  \n"+
  "  99           9   99              99          99    99 999 \n"+
  "  99          99   99   9          99         999    99  99 \n"+
  "  99         99    99   9          99         999    99  99 \n"+
  "  99        999    99   9          999         99    99  99 \n"+
  "  99        999    99   9           999         99   99  99 \n"+
  "  99         99    99   9            999         9   999 99 \n"+
  "  999         99   99                 999   9         99999 \n"+
  "  9999         9   999                 99   99         9999 \n"+
  "  99999   9         999            9   99    99         999 \n"+
  "  99 99   99         999           9   99    999         99 \n"+
  "  99 99    99         999          9   99    999         99 \n"+
  "  99 99    999         99          9   99    99          99 \n"+
  "  99 99    999         99          9   99   99           99 \n"+
  "  99 99    99          99              99   9            99 \n"+
  "  99999   99           999999         999            9   99 \n"+
  "   9999   9        9   9999999       999             99  99 \n"+
  "    999           99        999      99      9       999 99 \n"+
  "     99       9   99         99      9       99      999999 \n"+
  "      9      99   99          9                      999999 \n"+
  "            999   999999   9                         99 999 \n"+
  "                  99999    9                         99  999\n"+
  "9                          99               999999   99   99\n"+
  "99                         9999        99   999999   99 9  9\n"+
  "999       9999                          9   99       99 9   \n"+
  " 999     99999   999                        99       99 9 9 \n"+
  " 9999       99   99                         99       99 9 9 \n"+
  " 9 999      99   9                          99       99 9 9 \n"+
  " 9 9999     9         99999999999    9               99 9 9 \n"+
  " 9 9 99              99999999999     99            9999 9 9 \n"+
  " 9 9 99             999  9  999      999           9999 9 9 \n"+
  " 9 9 9999999       999  9  999        9999999999   99   9 9 \n"+
  " 9 9 999999       99999999999999999    999999999   99 999 9 \n"+
  " 9 9    99        999999999999999999               99 9   9 \n"+
  " 9 999999                         999              99 9 999 \n"+
  " 9     99                          999             99 9 9   \n"+
  " 99999999                           999            99 9 9   \n"+
  "       9999999999999999              9999999999999999       ",
  shipspawn: [{x:190,y:-190},{x:-190,y:190}],
  radar: {type:"box",width:15,height:15},
  basedmg: [{x:145,x2:225,y:-145,y2:-225},{x:-225,x2:-145,y:225,y2:145}]
  },
  {name: "Valhalla", author: "Robonuko", map:
    "  9999999999  9 999999999999 99 999999999999 9  9999999999  \n"+
    "  99     999  9 999        99  99        999 9  999     99  \n"+
    "  9       999 9 99          9999          99 9 999       9  \n"+
    "  9        99 9999           99           9999 99        9  \n"+
    "  9        99 9999                        9999 99        9  \n"+
    "     999   99999         9        9         99999  9999     \n"+
    "     9999   9999         99      99         9999   9999     \n"+
    "     99       99          99    99          99       99     \n"+
    "     99       99           99  99           99       99     \n"+
    "     99       99            9999            99       99     \n"+
    "     99       99             99             99       99     \n"+
    "      9       99                            99       9      \n"+
    "              9     9                  9     9              \n"+
    "                    99                99                    \n"+
    " 999                 99              99                 999 \n"+
    "  99                  9   99    99   9                  99  \n"+
    "                           99  99                           \n"+
    "      9                     9999                     9      \n"+
    "      99                     99                     99      \n"+
    "       99     9     9                  9     9     99       \n"+
    "        99    9    99                  99    9    99        \n"+
    "              9    99                  99    9              \n"+
    "    9         99   99        99        99   99         9    \n"+
    "99  999       99   99   99        99   99   99       999  99\n"+
    "99   999      99   99   9          9   99   99      999   99\n"+
    "99            99    9                  9    99            99\n"+
    "9             999          9    9          999             9\n"+
    "9       99     999        99    99        999     99       9\n"+
    "9      999     9999      99      99      9999     999      9\n"+
    "      999      9999       9      9       9999      999      \n"+
    "     999       99 9       9      9       9 99       999     \n"+
    "    999        99        99      99        99        999    \n"+
    "   999         99         99    99         99         999   \n"+
    "  9999     9    9          9    9          9    9     9999  \n"+
    "  99 9    99                                    99    9 99  \n"+
    "  9  9    99           9            9           99    9  9  \n"+
    "  9  9    99           99          99           99    9  9  \n"+
    "  9  9    99                 99                 99    9  9  \n"+
    "  9       99   9                            9   99       9  \n"+
    "  9       999  99                          99  999       9  \n"+
    "  9        999 99   9                  9   99 999        9  \n"+
    "            99999   99       99       99   99999            \n"+
    "             9999    99     9999     99    9999             \n"+
    "         9    999     9    99  99    9     999    9         \n"+
    "9        9     99         99    99         99     9        9\n"+
    "9        99          9                9          99        9\n"+
    "9        99          99              99          99        9\n"+
    "99   9   99           99            99           99   9   99\n"+
    "99   9    9   9        9            9        9   9    9   99\n"+
    " 9   99   9   99             99             99   9   99   9 \n"+
    " 9   99       99            9999            99       99   9 \n"+
    "     99       99           99  99           99       99     \n"+
    "     99       99          99    99          99       99     \n"+
    "     9999   9999         99      99         9999   9999     \n"+
    "     999   99999         9        9         99999   999     \n"+
    "  9        99 9999                        9999 99        9  \n"+
    "  9        99 9999           99           9999 99        9  \n"+
    "  9       999 9 99          9999          99 9 999       9  \n"+
    "  99     999  9 999        99  99        999 9  999     99  \n"+
    "  9999999999  9 999999999999 99 999999999999 9  9999999999  ",
  shipspawn: [{x:0,y:-235},{x:0,y:235}],
  radar: {type:"box",width:15,height:10},
  basedmg: [{x:-40,x2:40,y:-225,y2:-275},{x:-40,x2:40,y:225,y2:275}]
  },
  {name: "Plinko", author: "Robonuko", map:
    "335579999999999999999933399939939993339999999999999999975533\n"+
    "355799999999999999999999999999999999999999999999999999997553\n"+
    "5579999999          9999            9999          9999999755\n"+
    "779999 99                                          99 999977\n"+
    "779999999                                          999999977\n"+
    "779999 99            9                9            99 999977\n"+
    "577999999    9  9    99              99    9  9    999999775\n"+
    "357799 99   99  99   999  99    99  999   99  99   99 997753\n"+
    "355799999  999  999  999  999  999  999  999  999  999997553\n"+
    "557799999  999  999  999  999  999  999  999  999  999997755\n"+
    "55799999    7    9    9    9    9    9    9    7    99999755\n"+
    "5799999          7    7    7    7    7    7          9999975\n"+
    "799999                                                999997\n"+
    "99999                                                  99999\n"+
    "9999    898   99   99   99   99   99   99   99   988    9999\n"+
    "999      9    89    8    9   89   9    8    98    9      999\n"+
    "999                                                      999\n"+
    "9999                                                    9999\n"+
    "99999                                                  99999\n"+
    "9  998  99    99    99    99    99    99    99    99  899  9\n"+
    "9  998  9     99    9     99    99     9    99     9  899  9\n"+
    "99999                                                  99999\n"+
    "9999                                                    9999\n"+
    "999                                                      999\n"+
    "99   98    89    88    99    66    99    88    98    89   99\n"+
    "99   9      9    99    9     88     9    99    9      9   99\n"+
    "999                          99                          999\n"+
    "9999                        9999                        9999\n"+
    "99999                      995599                      99999\n"+
    "9  998  99    89      6789995555999876      98    99  899  9\n"+
    "9  998  99    89      6789995555999876      98    99  899  9\n"+
    "99999                      995599                      99999\n"+
    "9999                        9999                        9999\n"+
    "999                          99                          999\n"+
    "99   9      9    89    9     88     9    99    9      9   99\n"+
    "99   98    89    88    99    66    99    88    98    89   99\n"+
    "999                                                      999\n"+
    "9999                                                    9999\n"+
    "99999                                                  99999\n"+
    "9  998  9     98    9     99    99     9    99     9  899  9\n"+
    "9  998  99    99    99    99    99    98    98    99  899  9\n"+
    "99999                                                  99999\n"+
    "9999                                                    9999\n"+
    "999                                                      999\n"+
    "999      9    89    8    9   99   9    8    98    9      999\n"+
    "9999    899   99   99   99   99   99   99   99   998    9999\n"+
    "99999                                                  99999\n"+
    "799999                                                999997\n"+
    "5799999          7    7    7    7    7    7          9999975\n"+
    "55799999    7    9    9    9    9    9    9    7    99999755\n"+
    "557799999  999  999  999  999  999  999  999  999  999997755\n"+
    "355799999  999  999  999  999  999  999  999  999  999997553\n"+
    "357799 99   99  99   999  99    99  999   99  99   99 997753\n"+
    "577999999    9  9    99              99    9  9    999999775\n"+
    "779999 99            9                9            99 999977\n"+
    "779999999                                          999999977\n"+
    "779999 99                                          99 999977\n"+
    "5579999999          9999            9999          9999999755\n"+
    "355799999999999999999999999999999999999999999999999999997553\n"+
    "335579999999999999999933399939939993339999999999999999975533",
  shipspawn: [{x:0,y:-245},{x:0,y:245}],
  radar: {type:"box",width:20,height:10},
  basedmg: [{x:-40,x2:40,y:-225,y2:-275},{x:-40,x2:40,y:225,y2:275}]
  },
  {name: "Mothership", author: "EDEN", map:
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999            999999999999999999999999\n"+
    "9999999999999999999                      9999999999999999999\n"+
    "9999999999999999                            9999999999999999\n"+
    "99999999999999                                99999999999999\n"+
    "999999999999                                    999999999999\n"+
    "99999999999                                      99999999999\n"+
    "9999999999              99999  99999              9999999999\n"+
    "999999999             99969      96999             999999999\n"+
    "99999999            999666999  999666999            99999999\n"+
    "9999999           9996699999    9999966999           9999999\n"+
    "9999999          996699  99      99  996699          9999999\n"+
    "999999         999699     9      9     996999         999999\n"+
    "99999         99669                      96699         99999\n"+
    "99999        99699       7        7       99699        99999\n"+
    "9999         969         9        9         969         9999\n"+
    "9999        9969                            9699        9999\n"+
    "999        9969          9        9          9699        999\n"+
    "999        969           9        9           969        999\n"+
    "999       9969           99      99           9699       999\n"+
    "99        969            99      99            969        99\n"+
    "99        969             9      9             969        99\n"+
    "9        999     66  66   99    99   66  66     999        9\n"+
    "                   88      9    9      88                   \n"+
    "                 66  66     9  9     66  66                 \n"+
    "    999                                              999    \n"+
    "     9999  5                                    5  9999     \n"+
    "       99   7                44                7   99       \n"+
    "999          9              4884              9          999\n"+
    "999          9              4884              9          999\n"+
    "       99   7                44                7   99       \n"+
    "     9999  5                                    5  9999     \n"+
    "    999                                              999    \n"+
    "                 66  66     9  9     66  66                 \n"+
    "                   88      9    9      88                   \n"+
    "9        999     66  66   99    99   66  66     999        9\n"+
    "99        969             9      9             969        99\n"+
    "99        969            99      99            969        99\n"+
    "999       9969           99      99           9699       999\n"+
    "999        969           9        9           969        999\n"+
    "999        9969          9        9          9699        999\n"+
    "9999        9969                            9699        9999\n"+
    "9999         969         9        9         969         9999\n"+
    "99999        99699       7        7       99699        99999\n"+
    "99999         99669                      96699         99999\n"+
    "999999         999699     9      9     996999         999999\n"+
    "9999999          996699  99      99  996699          9999999\n"+
    "9999999           9996699999    9999966999           9999999\n"+
    "99999999            999666999  999666999            99999999\n"+
    "999999999             99969      96999             999999999\n"+
    "9999999999              99999  99999              9999999999\n"+
    "99999999999                                      99999999999\n"+
    "999999999999                                    999999999999\n"+
    "99999999999999                                99999999999999\n"+
    "9999999999999999                            9999999999999999\n"+
    "9999999999999999999                      9999999999999999999\n"+
    "999999999999999999999999            999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999",
  shipspawn: [{x:0,y:-250},{x:0,y:250}],
  radar: {type:"box",width:20,height:10},
  basedmg: [{x:-40,x2:40,y:-225,y2:-275},{x:-40,x2:40,y:225,y2:275}]
  },
  {name: "Vallhala", author: "EDEN", map:
    "334344443554666667999999999999999999999999999999999999976553\n"+
    "333544547766799999999999999999999999999999999999999999997743\n"+
    "3545547679999999999                                   999766\n"+
    "44444679999999                                         99976\n"+
    "4555669999                   9999           9           9997\n"+
    "55577999               9    99      9999    99   99      999\n"+
    "3466999               99   99      999999   99   99       99\n"+
    "556999                99   99     99   999       99       99\n"+
    "47799     99       99999   99    99     99       99       99\n"+
    "56999     99     9999999   99    99     99       999999   99\n"+
    "5799    9999   9999        9     99    999       999999   99\n"+
    "5799    9999   99                 9   999   99            99\n"+
    "6699           9     9999                   99            99\n"+
    "7999                999999                  99            99\n"+
    "799                99   99       99         99999    99   99\n"+
    "699                99   99       99         99999    999  99\n"+
    "799       9        99             99                      99\n"+
    "699      99         99            99                      99\n"+
    "999      99  99      99           99                      99\n"+
    "99       99  99       99           99           9999      99\n"+
    "99       99           99           99          999999     99\n"+
    "99       99           99     99    99          99  999    99\n"+
    "99       99999999   9999     99    99          9    99    99\n"+
    "99   9   9999999   99999    9999   999999           99    99\n"+
    "99   99                     9  9   999999999        99    99\n"+
    "99   99                                  999       99     99\n"+
    "99   99                                    99   9999      99\n"+
    "99   99  999999                            99  9999       99\n"+
    "99   999999999         99          99                 9   99\n"+
    "99   9999            999            999              99   99\n"+
    "99   99              999            999            9999   99\n"+
    "99   9                 99          99         999999999   99\n"+
    "99       9999  99                            999999  99   99\n"+
    "99      9999   99                                    99   99\n"+
    "99     99       999                                  99   99\n"+
    "99    99        999999999   9  9                     99   99\n"+
    "99    99           999999   9999    99999   9999999   9   99\n"+
    "99    99               99    99     9999   99999999       99\n"+
    "99    99    9          99    99     99           99       99\n"+
    "99    999  99          99           99           99       99\n"+
    "99     999999          99           99       99  99       99\n"+
    "99      9999            99           99      99  99      999\n"+
    "99                      99            99         99      996\n"+
    "99                      9999           99        9       996\n"+
    "99  999    99999          99      99   99                997\n"+
    "99   99    99999                  99   99                997\n"+
    "99            99                  999999                9996\n"+
    "99            99    999    9       9999     9           9967\n"+
    "99            99   999    99               99   9999    9974\n"+
    "99   999999        99     99    9        9999   9999    9964\n"+
    "99   999999        99     99   99   9999999     99     99974\n"+
    "99       99        999   99    99   99999       99     99664\n"+
    "99       99         999999     99   99                999645\n"+
    "99       99   99     9999      99   99               9997655\n"+
    "999      99   99              99    9               99967455\n"+
    "7999           9           9999                   9999764454\n"+
    "66999                                         99999996655454\n"+
    "476999                                   9999999999666455453\n"+
    "356699999999999999999999999999999999999999999997677754454333\n"+
    "334669999999999999999999999999999999999999776667454554453333",
  shipspawn: [{x:-235,y:-235},{x:235,y:235}],
  radar: {type:"box",width:10,height:10},
  basedmg: [{x:-40,x2:40,y:-225,y2:-275},{x:-40,x2:40,y:225,y2:275}]
  },
  {name: "Crystalized", author: "EDEN (ft. Robonuko)", map:
  "96  999999999999999999999999 99 999999999999999999999999  69\n"+
  "   99999999999999999999999999  99999999999999999999999999   \n"+
  "  999                      999999                      999  \n"+
  "  99                        9999                        99  \n"+
  "  9                9                    9                9  \n"+
  "            7     999                  999     7            \n"+
  "            9      9                    9      9            \n"+
  "          79997                              79997          \n"+
  "9           9          99          99          9           9\n"+
  "99          7          99          99          7          99\n"+
  "9                   999              999                   9\n"+
  "7                   999    99  99    999                   7\n"+
  "9                 99       99  99       99                 9\n"+
  "99          88    99     99      99     99    88          99\n"+
  " 9         6886          99      99          6886         9 \n"+
  " 99         99           99      99           99         99 \n"+
  "  9         66         99          99         66         9  \n"+
  "  99        99         99          99         99        99  \n"+
  "99 9       7997                              7997       9 99\n"+
  " 999       9  9              77              9  9       999 \n"+
  "  99       9  9              99              9  9       99  \n"+
  "   95     79  97            9999            79  97     59   \n"+
  "9   8     99  99            9  9            99  99     8   9\n"+
  "99        9 99 9            9  9            9 99 9        99\n"+
  " 99      99999999          99  99          99999999      99 \n"+
  "9 9      9 9999 9          9 99 9          9 9999 9      9 9\n"+
  "9 9      9 9  9 9         79 99 97         9 9  9 9      9 9\n"+
  "9 97     999  999        9999999999        999  999     79 9\n"+
  "9 99    999    999         99  99         999    999    99 9\n"+
  " 9 99                                                  99 9 \n"+
  " 9 99                                                  99 9 \n"+
  "9 99    999    999         99  99         999    999    99 9\n"+
  "9 97     999  999        9999999999        999  999     79 9\n"+
  "9 9      9 9  9 9         79 99 97         9 9  9 9      9 9\n"+
  "9 9      9 9999 9          9 99 9          9 9999 9      9 9\n"+
  " 99      99999999          99  99          99999999      99 \n"+
  "99        9 99 9            9  9            9 99 9        99\n"+
  "9   8     99  99            9  9            99  99     8   9\n"+
  "   95     79  97            9999            79  97     59   \n"+
  "  99       9  9              99              9  9       99  \n"+
  " 999       9  9              77              9  9       999 \n"+
  "99 9       7997                              7997       9 99\n"+
  "  99        99         99          99         99        99  \n"+
  "  9         66         99          99         66         9  \n"+
  " 99         99           99      99           99         99 \n"+
  " 9         6886          99      99          6886         9 \n"+
  "99          88    99     99      99     99    88          99\n"+
  "9                 99       99  99       99                 9\n"+
  "7                   999    99  99    999                   7\n"+
  "9                   999              999                   9\n"+
  "99          7          99          99          7          99\n"+
  "9           9          99          99          9           9\n"+
  "          79997                              79997          \n"+
  "            9      9                    9      9            \n"+
  "            7     999                  999     7            \n"+
  "  9                9                    9                9  \n"+
  "  99                        9999                        99  \n"+
  "  999                      999999                      999  \n"+
  "   99999999999999999999999999  99999999999999999999999999   \n"+
  "96  999999999999999999999999 99 999999999999999999999999  69",
  shipspawn: [{x:0,y:-235},{x:0,y:235}],
  radar: {type:"box",width:20,height:10},
  basedmg: [{x:-40,x2:40,y:-225,y2:-275},{x:-40,x2:40,y:225,y2:275}]
  },
];

game.custom.radar_background = {
  id: "radar_background",
  components: [],
};

var scale_pos = 100 / (modifier.map_size * 10);
var scale_size = 50 / modifier.map_size;
function addRadarSpot (x, y, type, width, height, alpha, color){
  game.custom.radar_background.components.push({
    type: type,
    position: [
      50+x*scale_pos-width*scale_size/2,
      50-y*scale_pos-height*scale_size/2,
      width*scale_size, height*scale_size,
    ],
    fill:`hsla(${color},100%,50%,${alpha})`
  });
}

var update = 1;
var delay = modifier.game_delay * 60;
if (!game.custom.map) game.custom.map = maps[Math.trunc(Math.random()*maps.length)];
var map = game.custom.map; // for debugging
for (let i=0; i<map.shipspawn.length; i++){
  addRadarSpot(map.shipspawn[i].x,map.shipspawn[i].y,map.radar.type,map.radar.width,map.radar.height,0.3,teams.hues[i]);
  addRadarSpot(map.shipspawn[i].x,map.shipspawn[i].y,map.radar.type,map.radar.width-2,map.radar.height-2,0.2,teams.hues[i]);
}

this.options = {
  vocabulary: vocabulary,
  custom_map: map.map,
  soundtrack: music[~~(Math.random()*music.length)],
  weapons_store: false,
  friendly_colors: !modifier.friendly_fire * 2,
  radar_zoom: 1,
  map_size: modifier.map_size,
  starting_ship: 801,
  crystal_value: modifier.crystal_value,
  speed_mod: 1.2,
  max_players: modifier.max_players,
  ships: ships,
  choose_ship: chooseships,
  release_crystal: modifier.yeet_gems,
  hues: [colors.hue,colors.hue2],
  asteroids_strength: 1e6,
  crystal_drop: 0,
  max_level: 1,
  mines_self_destroy: true,
  mines_destroy_delay: 0,
  projectile_speed: Number.MAX_VALUE
};

var check = function(game, isWaiting, isGameOver) {
  modUtils.tick();
  if (game.step % 30 === 0) {
    teams.count = [0,0];
    game.custom.kicked_ids.forEach(id => {
      let s = game.findShip(id);
      if (s && s.alive) s.set({kill: true})
    })
    for (let ship of game.ships) {
      if (!ship.custom.init){
        ship.custom = {
          init: true,
          frags: 0,
          deaths: 0,
          friendly_kills: 0,
          trolls_attempt: 0
        }
        setteam(ship);
        setup(ship);
        sendUI(ship, {
          id: "buy_lifes_blocker",
          visible: true,
          clickable: true,
          shortcut: String.fromCharCode(187),
          position: [65,0,10,10],
          components: []
        });
        sendUI(ship, game.custom.radar_background);
        echo(`${ship.name} spawned`);
        ship.custom.rand = ["","",""];
        ship.custom.buttons = false;
        if (isGameOver) gameover(ship);
      }
      else if (isGameOver && !ship.custom.exited) {
        modUtils.setTimeout(function(){gameover(ship)},300);
        ship.custom.exited = true
      }
      if (!ship.custom.joined && !isWaiting && !isGameOver) {
        joinmessage(ship);
        ship.custom.joined = true;
      }
      ship.set({idle: !!isWaiting, collider: !(isWaiting || isGameOver)})
      checkButtons(ship);
      teams.count[ship.custom.team]++;
      (ship.score != ship.custom.frags) && ship.set({score:ship.custom.frags});
      ship.emptyWeapons();
    }
  }
}, FormatTime = function(tick, forced, forceAll) {
  var array = Array(3).fill(0).map((i,j) => Math.floor((tick%(60**(j+2)))/(60**(j+1)))).reverse();
  while (array.length > forceAll && array[0] == 0) array.splice(0,1);
  forced = forced.reverse().slice(0,array.length).reverse();
  return array.map((i,j) => (i<10&&(j==0?forced[j]:!0))?"0"+i.toString():i).join(":");
}

var endgametext = ["Unknown", "Unknown"], endgamestatus = {};
var gameover = function (ship){
  let friendly_kills = modifier.friendly_fire ? ({"Friendly kills": ship.custom.friendly_kills}) : null;
  ship.gameover({
    "Match status": endgametext[0],
    "Match results": endgametext[1],
    "Frags": ship.custom.frags,
    ...friendly_kills,
    "Deaths": ship.custom.deaths,
    " ": " ",
    "#. Best killers":"Frags",
    ...endgamestatus
  });
  ship.custom.exited = true;
}

var waiting = function (game) {
  check(game, true);
  if (game.step % 30 === 0) for (let ship of game.ships){
    sendUI(ship, {
      id: "delay",
      position: [39,18,42,40],
      visible: true,
      components: [
        {type: "text",position:[2,5,80/1.5,33/1.5],value:"Waiting for more players...",color:"#cde"},
      ]
    });
    sendUI(ship, {
      id: "scoreboard",
      visible: true,
      components: [
        {type: "text",position:[15,0,70,10],value:"Waiting for more players...",color:"#cde"},
      ]
    });
  }
  if (game.step >= delay){
    checkscores(game);
    updatescoreboard(game);
    sendUI(game, {id:"delay time",visible:false});
    sendUI(game, {id:"delay",visible:false});
    this.tick = main_game;
  }
  else {
    sendUI(game, {
      id: "delay time",
      position: [45.7,26,10,7],
      visible: true,
      components: [
        {type: "text",position:[0,0,100,50],value:`${FormatTime(delay - game.step, [], 1)}`,color:"#cde"},
      ]
    });
  }
}, main_game = function(game){
  check(game);
  if (Math.min(...teams.count) == 0) finishgame(game, 2);
  else if (Math.max(...teams.points) >= modifier.kills_to_win) finishgame(game, 1);
  else if (game.step % 30 === 0){
    let time = delay+modifier.round_timer*3600;
    if (game.step < time){
      if (game.step > delay){
        sendUI(game, {
          id: "timer",
          position: [2.5,28,15,10],
          visible: true,
          components: [
            {type: "text",position:[0,0,100,50],value:`Time left: ${FormatTime(time - game.step, [false, true, true], 2)}`,color:"#cde"},
          ]
        });
      }
    } else finishgame(game, 0);
  }
  if (update){
    checkscores(game);
    updatescoreboard(game);
    update = 0;
  }
  if (game.step % 60 === 0){
    checkteambase(game)
    updatescoreboard(game);
  }
}, finishgame = function(game, condition) {
  // conditions: 0 (time's up), 1 (reach enough kills), 2 (all one team left)
  let win;
  if (condition != 2) {
    if (teams.points[0] != teams.points[1]){
      win = teams.points.indexOf(Math.max(...teams.points));
      endgametext = `${teams.names[win]} team wins!`;
    } else endgametext = "It's a draw!";
    endgametext = [condition?`${teams.names[win]} team reaches ${modifier.kills_to_win} kills`:"Time's up!", endgametext];
  }
  else {
    win = teams.count.indexOf(0);
    if (win == -1) return;
    win = 1 - win;
    endgametext = [`All ${teams.names[1-win]} players left`, `${teams.names[win]} team wins!`];
  }
  game.ships.sort((a,b) => (b.custom.frags || 0) - (a.custom.frags || 0)).slice(0,3).forEach((ship,i) => {
    endgamestatus[(i+1)+". "+ship.name] = ship.custom.frags
  });
  game.custom.ended = true;
  game.setOpen(false);
  sendUI(game, {
    id: "timer",
    position: [2.5,28,15,10],
    visible: true,
    components: [
      {type: "text",position:[0,0,100,50],value:"Game finished!",color:"#cde"},
    ]
  });
  sendUI(game, {
    id: "end",
    position: [35,20,30,15],
    visible: true,
    components: [
      {type:"text",position:[0,0,100,50],value:endgametext[0],color:"#cde"},
      {type:"text",position:[0,50,100,50],value:endgametext[1],color:"#cde"}
    ]
  });
  echo(endgametext);
  this.tick = endgame;
}.bind(this), endgame = function (game) {
  check(game, false, true);
};

this.tick = waiting;

function setup(ship){
  let t = ship.custom.team;
  let level = Math.trunc(ship.type/100); //level = (level<4)?4:level;
  let gems = ((modifier.round_ship_tier**2)*20)/1.5;
  let x = map.shipspawn[t].x,
  y = map.shipspawn[t].y,r=0;
  ship.set({x:x,y:y,stats:88888888,invulnerable:300,shield:999,crystals:gems});
}

function setteam(ship){
  let t;
  if ([...new Set(teams.count)].length == 1) t=teams.points.indexOf(Math.min(...teams.points));
  else t = teams.count.indexOf(Math.min(...teams.count));
  ship.custom.team = t;
  configship(ship, t);
  echo(teams.count);
}

function configship(ship,t){
  if (!modifier.friendly_fire) ship.set({team:t});
  ship.set({hue:teams.hues[t],invulnerable:300,stats:88888888});
}

function rekt(ship,num){
  if (ship.shield<num){
    let val=ship.crystals + ship.shield;
    if (val < num) ship.set({kill:true});
    else ship.set({crystals:val-num,shield:0});
  }
  else ship.set({shield:ship.shield-num});
}

function isRange(a,b,c){
  return Math.min(a,b) <= c && c <= Math.max(a,b)
}

function checkteambase(game){
  for (let ship of game.ships){
    let u = 1 - ship.custom.team;
    let x = map.basedmg[u];
    let y = map.basedmg[u];
    if (isRange(x.x,x.x2,ship.x) && isRange(y.y,y.y2,ship.y)){
      rekt(ship,10*Math.trunc(ship.type/100));
      sendUI(ship, {
        id: "dang",
        position: [34,20,40,40],
        visible: true,
        components: [{type:"text",position:[0,0,80,33],value:"You are in the emeny's base - your ship will take damage!",color:"#f99e9e"}]
      });
    } else sendUI(ship, {id:"dang",visible:true});
  }
}

var scoreboard = {
  id:"scoreboard",
  visible: true,
  components: []
};

function getcolor(color){
  return `hsla(${color},100%,50%,1)`;
}

function PlayerBox(posx,posy){
  return {type:"box",position:[posx,posy-1.8,50,7],fill:"hsla(210,24.3%,29%,0.5)",width:2};
}

function Tag(indtext,param,posx,posy,hex,al,size) {
  let obj= {type: indtext,position: [posx,posy-0.5,50-(size||0),5],color: hex,align:al};
  switch(indtext) {
    case "text":
      obj.value=param;
      break;
    case "player":
      obj.id=param;
    break;
  }
  return obj;
}

function sort(arr){
  let array=[...arr],i=0;
  while (i<array.length-1) {
    if (array[i].custom.frags<array[i+1].custom.frags) {
      array[i+1]=[array[i],array[i]=array[i+1]][0];
      if (i>0) i-=2;
    }
    i++;
  }
  return array;
}

function updatescoreboard(game){
  if (game.step >= delay){
    let t=[[],[]];
    for (let ship of game.ships) if (ship.custom.team != null) t[ship.custom.team].push(ship);
    scoreboard.components = [
      { type:"box",position:[0,0,50,8],fill:getcolor(teams.hues[0])},
      { type: "text",position: [0,0,50,8],color:"#e5e5e5",value: teams.names[0]},
      { type:"box",position:[50,0,50,8],fill:getcolor(teams.hues[1])},
      { type: "text",position: [50,0,50,8],color:"#e5e5e5",value: teams.names[1]}
    ];
    let sc=[sort(t[0]),sort(t[1])],line=1;
    sc[0].slice(10);sc[1].slice(10);
    for (let i=0;i<10;i++){
      for (let j=0;j<2;j++){
        if (sc[j][i]) scoreboard.components.push(
          new Tag("text",sc[j][i].custom.frags,j*50,line*10,"#cde","right",2),
          new Tag("player",sc[j][i].id,j*50,line*10,"#cde","left")
        );
        else scoreboard.components.push({},{});
      }
      line++;
    }
    outputscoreboard(game,sc);
  }
}

function outputscoreboard(game,tm){
  let origin =[...scoreboard.components];
  for (let ship of game.ships){
    if (ship.custom.team == null) continue;
    let j=0,team=tm[ship.custom.team];
    for (j=0;j<team.length;j++){
      if (ship.id === team[j].id){
        scoreboard.components.splice((j*2+ship.custom.team)*2+4,0,
          new PlayerBox(ship.custom.team*50,(j+1)*10)
        );
        break;
      }
    }
    if (j == team.length) scoreboard.components.splice((20+ship.custom.team)*2,2,
      new PlayerBox(ship.custom.team*50,90),
      new Tag("text",ship.custom.frags,ship.custom.team*50,90,ship.custom.team,"right",2),
      new Tag("player",ship.id,ship.custom.team*50,90,ship.custom.team,"left")
    );
    sendUI(ship, scoreboard);
    scoreboard.components = [...origin];
  }
}

let checkscores = function (game){
  if (game.step >= delay) {
    let joint = " - ";
    let scoreLens = teams.points.map(p => p.toString().length), scoreMaxLen = Math.max(...scoreLens);
    let digitWidth = 3;
    let totalLen = scoreMaxLen * 2 + joint.length;
    let PointPercentage = scoreMaxLen / totalLen * 100;
    let jointPercentage = joint.length / totalLen * 100;
    scoreLens = scoreLens.map(i => i / totalLen * 100);
    let UIwidth = totalLen * digitWidth;
    sendUI(game, {
      id: "scores",
      position: [(100 - UIwidth) / 2, 10, UIwidth, 10],
      visible: true,
      components: [
        {type: "text", position: [PointPercentage - scoreLens[0], 0, scoreLens[0], 100], value: teams.points[0], color: getcolor(teams.hues[0])},
        {type: "text", position: [PointPercentage, 0, jointPercentage, 100], value: joint, color: "#CDE"},
        {type: "text", position: [PointPercentage + jointPercentage, 0, scoreLens[1], 100], value: teams.points[1], color: getcolor(teams.hues[1])},
      ]
    });
  }
}

let createInfoMessage = function(id, height_per_line, duration, ...messages) {
  messages = messages.filter(i => i);
  let heightPercentage = 100 / messages.length;
  return {
    id: id || "join_info",
    position: [25, 20, 50, messages.length * (height_per_line || 5)],
    visible: true,
    components: messages.map((message, i) => ({type: "text", position: [0, heightPercentage * i, 100, heightPercentage], value: message, color: "#cde"})),
    duration: duration || (60 * 5)
  }
}

let infoMessages = [
  createInfoMessage("join_info", null, 60 * 10, `First team to reach ${modifier.kills_to_win} points wins`, "Kill an enemy to earn 1 point for your team", "Good luck and have fun!"),
  createInfoMessage("tips", 3, 60 * 10, "Please DO NOT try to mine the asteroids", "Mining is pointless! Asteroids are unbreakable", "Suicide deduces 1 point from your team. Be careful!")
];


let queueInfoMessages = function (ship) {
  let timestamp = 0, lastID;
  for (let info of infoMessages) {
    if (lastID) {
      let cLastID = lastID;
      modUtils.setTimeout(() => sendUI(ship, {id: cLastID, visible: false}), timestamp)
    }
    modUtils.setTimeout(() => sendUI(ship, info), timestamp);
    timestamp += info.duration;
    lastID = info.id;
  }
  if (lastID) modUtils.setTimeout(() => sendUI(ship, {id: lastID, visible: false}), timestamp);
}

let joinmessage = function (ship){
  queueInfoMessages(ship);
  sendUI(ship, {
    id: "map info",
    position: [0,92,40,4],
    visible: true,
    components: [
      {type: "text",position:[0,0,100,100],value:` Map: ${map.name} by ${map.author}`,color:"#cde", align: "left"},
    ]
  });
  if (modifier.friendly_fire) sendUI(ship, {
    id: "friendly_fire_warning",
    position: [40,92,40,4],
    visible: true,
    components: [
      {type: "text",position:[0,0,100,100],value: "WARNING: Friendly fire is OFF",color:"hsla(60, 100%, 50%, 1)", align: "right"},
    ]
  });
}

function checkButtons(ship){
  let shortcut = ["5","6","7"];
  for (let i=0; i<3; i++){
    sendUI(ship, {
      id: "ship_selection_"+i,
      position: [36,26+i*7,34,18/2],
      visible: ship.custom.buttons&&ship.custom.opened,
      clickable: ship.custom.buttons&&ship.custom.opened,
      shortcut: shortcut[i],
      components: [
        {type: "box",position:[0,0,88,40*2],stroke:"#191919",fill:"#333333",width:5},
        {type: "text",position:[0,4,88/1.2,40/1.2*2],value:`     ${ship.custom.rand[i]} [${shortcut[i]}]`,color:"#cde"},
      ]
    });
  }
  sendUI(ship, {
    id: "close",
    position: [43,26+4*7,34/2,18/2],
    visible: ship.custom.buttons&&ship.custom.opened,
    clickable: ship.custom.buttons&&ship.custom.opened,
    shortcut: "4",
    components: [
      {type: "box",position:[0,0,88,40*2],stroke:"#191919",fill:"#333333",width:5},
      {type: "text",position:[0,4,88/1.2,40/1.2*2],value:"    Close [4]",color:"#cde"},
    ]
  });
  sendUI(ship, {
    id: "open",
    position: [3,33,16,20/2],
    visible: ship.custom.buttons&&!ship.custom.opened,
    clickable: ship.custom.buttons&&!ship.custom.opened,
    shortcut: "4",
    components: [
      {type: "box",position:[0,0,88,40*2],stroke:"#191919",fill:"#333333",width:5},
      {type: "text",position:[6,4,88/1.2,40/1.2*2],value:"Select ship [4]",color:"#cde"},
    ]
  });
  sendUI(ship, {
    id: "heal",
    position: [3,42,16,20/2],
    visible: ship.custom.buttons&&modifier.healer_button,
    clickable: ship.custom.buttons&&modifier.healer_button,
    shortcut: "J",
    components: [
      {type: "box",position:[0,0,88,40*2],stroke:"#191919",fill:"#333333",width:5},
      {type: "text",position:[6,4,88/1.2,40/1.2*2],value:`${(ship.healing)?"Offensive":"Healing"} [J]`,color:"#cde"},
    ]
  });
}

this.event = function(event, game){
  let ship = event.ship;
  if (ship != null) switch (event.name){
    case "ship_destroyed":
      if (game.custom.kicked_ids.indexOf(ship.id) == -1) {
        let killer = event.killer;
        ship.set({collider:true});
        if (killer != null && game.custom.kicked_ids.indexOf(killer.id) == -1) {
          if (killer.custom.team != ship.custom.team) {
            ++teams.points[killer.custom.team];
            ++killer.custom.frags;
            killer.custom.trolls_attempt = 0
          }
          else {
            ++killer.custom.friendly_kills;
            ++killer.custom.trolls_attempt;
            if (killer.custom.trolls_attempt >= modifier.max_trolls_attempt) {
              killer.gameover({
                "You have been kicked!": " ",
                "Come on, you can't even distinguish": " ",
                " ": "between your teammates and enemies ??"
              });
              game.custom.kicked_ids.push(killer.id);
            }
          }
          echo(`${killer.name} killed ${ship.name}`)
        } else {
          teams.points[ship.custom.team] = Math.max(0, --teams.points[ship.custom.team])
          echo(ship.name + " killed themselves");
        }
        ship.custom.deaths++;
        update = 1;
        ship.custom.hasbeenkilled = true;
        echo(`${teams.names[0]}:${teams.points[0]},${teams.names[1]}:${teams.points[1]}`);
      }
      break;
    case "ship_spawned":
      if (ship.custom.hasbeenkilled === true){
        ship.custom.rand = shuffle(ship_name);
        ship.custom.buttons = true;
        ship.custom.opened = false;
        modUtils.setTimeout(function(){
          ship.custom.buttons = false;
        },540);
        ship.custom.hasbeenkilled = false;
      }
      if (ship.custom.team != null) setup(ship);
      update = 1;
      break;
    case "ui_component_clicked":
      if (ship.custom.buttons) {
        let component = event.id;
        switch (component){
          case "open": ship.custom.opened = true; break;
          case "heal": ship.set({healing:!ship.healing}); break;
          case "close": ship.custom.opened = false; break;
          default:
            if (component.startsWith("ship_selection_") && ship.custom.opened){
              let ship_code = findShipCode(ship.custom.rand[parseInt(component.replace(/^ship_selection_/,"")) || 0]);
              if (ship_code){
                if (ship.type != ship_code) ship.set({type:ship_code,stats:88888888,shield:999,collider:true});
              }
              ship.custom.opened = false;
              ship.custom.buttons = false;
            }
          break;
        }
      }
    break;
  }
};

var tree = {
  id: "tree",
  obj: "https://raw.githubusercontent.com/45rfew/Starblast-mods-n-objs/master/Tree.obj",
  diffuse: "https://raw.githubusercontent.com/45rfew/Starblast-mods-n-objs/master/Img/green.png",
};

var present = {
  id: "present",
  obj: "https://starblast.data.neuronality.com/models/xmas/gift/model.obj",
  diffuse: "https://starblast.data.neuronality.com/models/xmas/gift/lambert.jpg",
  emissive: "https://starblast.data.neuronality.com/models/xmas/gift/emissive.jpg",
  specular: "https://starblast.data.neuronality.com/models/xmas/gift/specular.jpg"
};

var pumpkin = {
  id: "pumpkin",
  obj: "https://starblast.data.neuronality.com/models/halloween/pumpkin/model.obj",
  diffuse: "https://raw.githubusercontent.com/45rfew/Starblast-mods-n-objs/master/Img/pumpkin%20lambert.jpg",
  emissive: "https://starblast.data.neuronality.com/models/halloween/pumpkin/emissive.jpg",
};

var alien = {
  id: "alien",
  obj: "https://starblast.data.neuronality.com/models/aliens/10/model.obj",
  diffuse: "https://starblast.data.neuronality.com/models/aliens/10/lambert.jpg",
  emissive: "https://starblast.data.neuronality.com/models/aliens/10/emissive.jpg",
  emissiveColor: 0xff0000,
  transparent: false,
};

/*if (map_id === 0 && modifier.laggy_objs){
  game.setObject({
    id: "tree",
    type: tree,
    position: {x:0,y:0,z:-13},
    rotation: {x:Math.PI/2,y:0,z:0},
    scale: {x:5,y:5,z:5}
  });
  for (let i=0; i<6; i++){
    let th = (i/6)*Math.PI*2;
    let rd = 13;
    game.setObject({
      id: "present"+i,
      type: present,
      position: {x:Math.cos(th)*rd,y:Math.sin(th)*rd,z:-10},
      rotation: {x:0,y:0,z:Math.random()*Math.PI/2},
      scale: {x:2,y:2,z:2}
    });
  }
} else if (map_id === 1 && modifier.laggy_objs){
  let objx = [0,20,-16,-2,13,3,-11], objy = [0,5,-6,-22,-14,15,11], scale = [0,1.5,1.5,1.6,1.8,2,2];
  for (let i=0; i<7; i++){
    game.setObject({
      id: "pumpkin"+i,
      type: pumpkin,
      position: {x:objx[i],y:objy[i],z:-10/scale[i]},
      rotation: {x:Math.PI/2,y:Math.random()*Math.PI*2,z:(Math.random()*Math.PI)/8},
      scale: {x:6/scale[i],y:5/scale[i],z:6/scale[i]}
    });
  }
  game.setObject({
    id: "pumpkin",
    type: pumpkin,
    position: {x:0,y:0,z:-10},
    rotation: {x:Math.PI/2,y:Math.random()*Math.PI*2,z:0},
    scale: {x:6,y:5,z:6}
  });
  let alienx = [-18,11,18,-11], alieny = [5,11,-7,-16];
  for (let i=0; i<4; i++){
    game.setObject({
      id: "alien"+i,
      type: alien,
      position: {x:alienx[i],y:alieny[i],z:-10},
      rotation: {x:0,y:0,z:Math.PI/2+((Math.random() - 0.5)*2)/4},
      scale: {x:.4,y:.4,z:.4}
    });
  }
}*/

var removed_maps = [
  {name: "Boxes 2.0", author: "EDEN", map:
    "                                                            \n"+
    "                                                            \n"+
    "                                                            \n"+
    " 9999999999999999999999999999999999999999999999999999999999 \n"+
    " 9999999999999999999999999999999999999999999999999999999999 \n"+
    " 99999999999                                    99999999999 \n"+
    " 9999999999                                      9999999999 \n"+
    " 9999999999    999999999999      999999999999    9999999999 \n"+
    " 9999999999   99999999999999    99999999999999   9999999999 \n"+
    " 9999999999  9999999999999999  9999999999999999  9999999999 \n"+
    " 9999999999  9999999999999999  9999999999999999  9999999999 \n"+
    " 9999999999  9999999999999999  9999999999999999  9999999999 \n"+
    " 9999999999  9999999999999999  9999999999999999  9999999999 \n"+
    " 999999999    999999999999999  999999999999999    999999999 \n"+
    " 999999999     99999999999999  99999999999999     999999999 \n"+
    " 999                       99  99                       999 \n"+
    " 99                       999  999                       99 \n"+
    " 99                      999    999                      99 \n"+
    " 99                     999      999                     99 \n"+
    " 99                    999        999                    99 \n"+
    " 99                    999        999                    99 \n"+
    " 99                    9999      9999                    99 \n"+
    " 99                   999999    999999                   99 \n"+
    " 99                9999999999  9999999999                99 \n"+
    " 99               99999999999  99999999999               99 \n"+
    " 99              999999999999  999999999999              99 \n"+
    " 99             999  99999999  99999999  999             99 \n"+
    " 99      9     999    999999    999999    999     9      99 \n"+
    " 99      99   999      9999      9999      999   99      99 \n"+
    " 99      99                  99                  99      99 \n"+
    " 99      99                  99                  99      99 \n"+
    " 99      99   999      9999      9999      999   99      99 \n"+
    " 99      9     999    999999    999999    999     9      99 \n"+
    " 99             999  99999999  99999999  999             99 \n"+
    " 99              999999999999  999999999999              99 \n"+
    " 99               99999999999  99999999999               99 \n"+
    " 99                9999999999  9999999999                99 \n"+
    " 99                   999999    999999                   99 \n"+
    " 99                    9999      9999                    99 \n"+
    " 99                    999        999                    99 \n"+
    " 99                    999        999                    99 \n"+
    " 99                     999      999                     99 \n"+
    " 99                      999    999                      99 \n"+
    " 99                       999  999                       99 \n"+
    " 999                       99  99                       999 \n"+
    " 999999999     99999999999999  99999999999999     999999999 \n"+
    " 999999999    999999999999999  999999999999999    999999999 \n"+
    " 9999999999  9999999999999999  9999999999999999  9999999999 \n"+
    " 9999999999  9999999999999999  9999999999999999  9999999999 \n"+
    " 9999999999  9999999999999999  9999999999999999  9999999999 \n"+
    " 9999999999  9999999999999999  9999999999999999  9999999999 \n"+
    " 9999999999   99999999999999    99999999999999   9999999999 \n"+
    " 9999999999    999999999999      999999999999    9999999999 \n"+
    " 9999999999                                      9999999999 \n"+
    " 99999999999                                    99999999999 \n"+
    " 9999999999999999999999999999999999999999999999999999999999 \n"+
    " 9999999999999999999999999999999999999999999999999999999999 \n"+
    "                                                            \n"+
    "                                                            \n"+
    "                                                            ",
  shipspawn: [{x:-235,y:0},{x:235,y:0}],
  radar: {type:"box",width:8,height:12}},
  {name: "Alleyway", author: "Healer", map:
    "999999989899998888989899998888898899998888888899998988889999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999                999                999                999\n"+
    "99                  999              999                  99\n"+
    "99                  99999999999999999999                  99\n"+
    "99                   999999999999999999                   99\n"+
    "999999                                                999999\n"+
    "999                                                      999\n"+
    "99      89998888    8888899  999999    88888   88999      99\n"+
    "99     899               99     99                998     99\n"+
    "99  9  8999              99      99              9998  9  99\n"+
    "99 8   88999            99        99            99988   9 99\n"+
    "9988   889999           9          9           999988   9999\n"+
    "9988   88999999        999                   99999988   9989\n"+
    "9988     9999 9        9999                  9 9999     9999\n"+
    "998       99   9      9999       99999      9   99       899\n"+
    "99                    999           99                    99\n"+
    "99                    99             9                    99\n"+
    "99                    9             99                    99\n"+
    "99                    99           999                    99\n"+
    "998       99   9      99999       9999      9   99       899\n"+
    "9988     9999 9                  9999        9 9999     9999\n"+
    "9988   88999998                   999        99999988   9989\n"+
    "9998   889999           9          9           999988   9999\n"+
    "99 9   88899            99        99            99988   9 99\n"+
    "99  9  8899              99      99              9998  9  99\n"+
    "99     999                99     99               999     99\n"+
    "99      99998   88888    999999  8888888    88888889      99\n"+
    "999                                                      999\n"+
    "999999                                                999999\n"+
    "99                   999999999999999999                   99\n"+
    "99                  99999999999999999999                  99\n"+
    "99                  999              999                  99\n"+
    "999                999                999                999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999999999999999999999999999999999999999999999999999999999999\n"+
    "999988889899989888999899998888888899998999888989998988889999",
  shipspawn: [{x:-235,y:0},{x:235,y:0}],
  radar: {type:"box",width:8,height:12}},
  {name: "Atoms", author: "45rfew", map:
    "                                                            \n"+
    "                                                            \n"+
    "                                                            \n"+
    "                                               99999        \n"+
    "                                             9999999999     \n"+
    "                                            9999999999999   \n"+
    "                                            99999999999999  \n"+
    "                                            999      99999  \n"+
    "                                           9999       9999  \n"+
    "                                          9999         999  \n"+
    "                                          9999         999  \n"+
    "                                         99999         999  \n"+
    "                                        999999         999  \n"+
    "                                       999999          999  \n"+
    "                                      999999          9999  \n"+
    "                       99  9    99  9999999    9     9999   \n"+
    "                      99  99999999  999999    99999999999   \n"+
    "                     99   999999999999999    9999999999     \n"+
    "                    999  999999999999999    9999999         \n"+
    "                    9999999999999999999    999999           \n"+
    "                   9999999999999999999    9999999           \n"+
    "                   999999999999999999    999999             \n"+
    "                  999999999      999    9999999             \n"+
    "                  999999               999999               \n"+
    "                  99999               999999                \n"+
    "                  99999              9999999                \n"+
    "                  99999              999999                 \n"+
    "                 99999                99999                 \n"+
    "                 99999                99999                 \n"+
    "                 99999                99999                 \n"+
    "                 99999                9999                  \n"+
    "                 99999                9999                  \n"+
    "                 99999                9999                  \n"+
    "                 999999               9999                  \n"+
    "                 999999              99999                  \n"+
    "            9   999999               99999                  \n"+
    "           9  9999999               999999                  \n"+
    "         999 9999999    999       9999999                   \n"+
    "        999 9999999    9999999999999999                     \n"+
    "        9999999999    9999999999999999                      \n"+
    "    9999999999999    99999999999999                         \n"+
    "    999999999999    99999999999999                          \n"+
    "   999999999999    99999999                                 \n"+
    "   99999999999    99999                                     \n"+
    "  99999     9    99999                                      \n"+
    "  9999          99999                                       \n"+
    "  999          999999                                       \n"+
    "  999         999999                                        \n"+
    "  999         999999                                        \n"+
    "  999         99999                                         \n"+
    "  999         99999                                         \n"+
    "  9999       999999                                         \n"+
    "  99999      999999                                         \n"+
    "   9999999999999999                                         \n"+
    "    9999999999999                                           \n"+
    "     999999999999                                           \n"+
    "        999999                                              \n"+
    "                                                            \n"+
    "                                                            \n"+
    "                                                            ",
    shipspawn: [{x:-204,y:-185},{x:204,y:185}],
    radar: {type:"round",width:15,height:15},
    basedmg: [{x:-175,x2:-230,y:-150,y2:-215},{x:175,x2:230,y:150,y2:215}]
  },
  {name: "Stadium 2.0", author: "Liberal", map:
    "99       99999999999999999999999999999    999    999       9\n"+
    "999       99999999999999999999999999999    999    999       \n"+
    " 999                                 999    999    999      \n"+
    "  999                                 999    999    999     \n"+
    "   999                                 999    999    999    \n"+
    "    99                                  999    999    999   \n"+
    "            99999999999999999999999      999    999    999  \n"+
    "             999999999999999999999        999    999    999 \n"+
    "              999             999          9999999999    999\n"+
    "9              999           999            9999999999    99\n"+
    "99              999999999999999                     999    9\n"+
    "99               9999999999999                      9999    \n"+
    "99    9                            9999             99999   \n"+
    "99    99                          999999            99 999  \n"+
    "99    999                        999  999           99  999 \n"+
    "99    9999                      999    999           9   999\n"+
    "99    99999                    999      9999999           99\n"+
    "99    99 999                  999        999999           99\n"+
    "99    99  99                 999             99           99\n"+
    "99    99  99                999              99           99\n"+
    "99    99  99               999               99     9     99\n"+
    "99    99  99               99                99     99    99\n"+
    "99    99  99               99                99     99    99\n"+
    "99    99  99               99               999     99    99\n"+
    "99    99  99              999              999      99    99\n"+
    "99    99  99             999              999       99    99\n"+
    "99    99  99            999              999       9999   99\n"+
    "99    99  99        999999              999       999999  99\n"+
    "99    99 999       999999              999       999  999 99\n"+
    "99    99999       999                 999       999    99999\n"+
    "99    9999       999                 999       999      9999\n"+
    "99    999       999                 999       999        999\n"+
    "99    99       999                 999       999          99\n"+
    "99    9       999                 999       999           99\n"+
    "99           999                 999       999            99\n"+
    "99          999                 99999       999           99\n"+
    "99          99                 999 999       999          99\n"+
    "99          99                999   999       999         99\n"+
    "999         999              999     999       999        99\n"+
    " 999         999            999       999       999       99\n"+
    "  999         999          999         999       999      99\n"+
    "   999         999        999           999       999     99\n"+
    "9   999         99       999             999       999    99\n"+
    "99   999        99      999       9       999       999   99\n"+
    "999   999       99     999       999       999       999  99\n"+
    " 999   999      999999999       99999       999       999 99\n"+
    "  999   99      99999999       999 999       999       99999\n"+
    "   999  99                    999   999       999       9999\n"+
    "    999 99                   999     999       999       999\n"+
    "     99999                  999       999       999       99\n"+
    "9     9999                 999         999       999       9\n"+
    "99     999                999           999       999       \n"+
    "999     9999999     99999999             999       999      \n"+
    " 999     9999999     9999999              999       999     \n"+
    "  999     999             999              999       999    \n"+
    "   999     999             999              999       999   \n"+
    "    999     999             999              999       999  \n"+
    "     999     999             999              999       999 \n"+
    "      999     999999999999999999999999999999999999       999\n"+
    "9      999     999999999999999999999999999999999999       99",
  shipspawn: [{x:-90,y:-260},{x:260,y:90}],
  radar: {type:"box",width:10,height:10},
  basedmg: [{x:-110,x2:-70,y:-280,y2:-240},{x:240,x2:280,y:70,y2:110}]
  }
];
